func_breakable_surf
| CBreakableSurface |
func_breakable_surf is a brush entity available in all
Source games.
It defines a breakable surface, for partially breakable glass/tile/etc. All faces that are not ever visible to the player should use nodraw. Faces that will be broken must have exactly four sides. The material applied to the visible face must be set up to be breakable. This entity is functionally similar to real-life tempered glass.
The following standard textures are meant to work with this entity (using any other may crash the game on startup!):
glass/glasswindowbreak070a(but notglass/glasswindowbreak070b!)tile/tilebreak001c(using this will stretch the texture if broken)glass/urban_glass_3(only in
)
|
Info for creating a material compatible with func_breakable_surf can be found here
0 0 0, otherwise the surface will disappear or become misplaced when damaged. With default FGDs this is a non-issue as the entity lacks an origin keyvalue entirely, but some custom FGDs add one, likely being unaware of this bug. If the entity appears with an origin keyvalue in Hammer, make sure to always set it to 0 0 0 after moving, rotating, or scaling the entity in order for it to behave correctly.
Confirm:By extension, the entity probably also breaks if parented.
self.ConnectOutput("OnBreak", "OnBreak");
function OnBreak()
{
self.RemoveSolidFlags(Constants.FSolid.FSOLID_NOT_SOLID);
self.SetCollisionGroup(27); // TFCOLLISION_GROUP_ROCKET_BUT_NOT_WITH_OTHER_ROCKETS
}
|
You can partially workaround it by making crack texture pretty mute/dark (because the lighting is displayed ONLY on the lightmap).
|
|
Flags
- Physics damage decals : [1]
- Take damage from held objects : [2]
- Break on Pressure : [4]
- Break immediately on Physics : [512]
- Don't take physics damage : [1024]
- Don't allow bullet penetration : [2048]
Keyvalues
parentname or target).Also displayed in Hammer's 2D views and Entity Report.
Fragility (fragility) <integer>
Surface Type (surfacetype) <choices>
- 0: Glass
- 1: Tile
- 0: No Error
- 1: Multiple Textured Faces
- 2: Non-Square Face
| Breakable (brush):
Prop Data (propdata) <integer choices> Set to the best approximation of the size and material of this entity's brushes. If set, this will override Strength and Material Type. If set, it will override this entity's health and damage taken from various weapons. See prop_data base types for what each entry specifies.
Strength/Health (health) <integer> The damage to take before breaking. The brush will not break from damage if this is 0.
Material Type (material) <integer choices> Set to the material type of the brush. Decides what sounds to make when damaged, and what gibs to produce when broken.
Gibs Direction (explosion) <integer choices> Used to decide which direction to throw gibs when broken.
Precise Gib Direction (gibdir) <QAngle> An exact direction in which to throw gibs when breaking. Be sure to select "Use Precise Gib Dir" in Gibs Direction!
Damaging it Doesn't Push It (nodamageforces) <boolean> When enabled the brush will move in response to damage.
Gib Model (gibmodel) <model path> Specify a custom gib model to break into, overriding the Material Type.
func_break.cpp, as well as their associated #endifs.Spawn On Break (spawnobject) <integer choices> When broken, an entity of the selected type will be created.
func_break.cpp.
Explode Magnitude (explodemagnitude) <integer>
Breakable (common): Performance Mode (PerformanceMode) <choices> Used to limit the amount of gibs produced when this entity breaks, for performance reasons.
Min Damage to Hurt (minhealthdmg) <integer> If a single hit to the object doesn't do at least this much damage, the prop won't take any of the damage it attempted to give.
Pressure Delay (PressureDelay) <float> Seconds to delay breaking from pressure. Allows creaking/groaning sounds to play.
Health (health) <integer> How close to breaking the object is.
Maximum Health (max_health) <integer> Health cannot exceed this amount.
Physics Impact Damage Scale (physdamagescale) <float> Multiplier for damage amount when this entity is hit by a physics object. With a value of 0 the entity will take no damage from physics.
|
Inputs
- Shatter <vector3>
- Shatter the window. Input a vector. First two coordinates are the X,Y center of the shattering (as values from 0-1). The third coordinate is the radius of the shatter, in hammer units.
BreakableBrush:
|
Outputs
BreakableBrush:
- OnBreak
- !activator = entity that breaks the object
!caller = this entity
Fired when this object breaks.
- OnHealthChanged <float>
- !activator = entity that caused the health change
!caller = this entity
Fired whenever the health of the breakable has increased or decreased. This output automatically puts the new health amount as a decimal percent (e.g. 45% = 0.45) into the parameter box for inputs, if the mapper does not override the parameter with something else.
See also
- func_breakable
- Breakable Glass - How to create breakable glass.
- Glass that starts out broken - Making glass spawn broken.
