Func breakable surf: Difference between revisions
Jump to navigation
Jump to search

Bug:The entity must have its origin at
Bug:This entity is available and functional in
, although without the ability to break the glass with bullets (unlike in
,
and other source games).
Workaround:Assign this VScript code as an Entity Script on the entity to fix bullet damage not functioning.
[todo tested in ?]
MyGamepedia (talk | contribs) |
MyGamepedia (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
Info for creating a material compatible with func_breakable_surf can be found [[Making a custom breakable surface|here]] | Info for creating a material compatible with func_breakable_surf can be found [[Making a custom breakable surface|here]] | ||
{{bug|The entity must have its origin at <code>0 0 0</code>, otherwise the surface will disappear or become misplaced when damaged. With default [[FGD]]s 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 <code>0 0 0</code> after moving, rotating, or scaling the entity in order for it to behave correctly.}} | {{bug|The entity must have its origin at <code>0 0 0</code>, otherwise the surface will disappear or become misplaced when damaged. With default [[FGD]]s 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 <code>0 0 0</code> after moving, rotating, or scaling the entity in order for it to behave correctly.|hidetested=1}} | ||
:{{confirm|By extension, the entity probably also breaks if parented.}} | :{{confirm|By extension, the entity probably also breaks if parented.}} | ||
{{bug|The break sound will play from both the entity and the origin of the map (0,0,0), if this entity is placed on the boundary of the default [[visleaf]] cuts (indicated by blue lines in [[Hammer]] 2D view).}} | {{bug|The break sound will play from both the entity and the origin of the map (0,0,0), if this entity is placed on the boundary of the default [[visleaf]] cuts (indicated by blue lines in [[Hammer]] 2D view).}} |
Revision as of 10:10, 5 January 2025


![]() |
---|
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 not glass/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
}
|
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
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Fragility (fragility) <integer>
- If the 'Surface Type' is set to Glass, this value sets how fragile the glass pieces are after the surface has been broken.
- Surface Type (surfacetype) <choices>
- Surface material type
- 0: Glass
- 1: Tile
- Invalid (error) <choices> !FGD
- Set automatically by Hammer to indicate an invalid glass/tile surface, when non-zero the entity will be removed when spawned, and a error message will be thrown in the console. This keyvalue is not included in Valve's FGDs, but is still fully functional.
- 0: No Error
- 1: Multiple Textured Faces
Note:You must use tools/toolsnodraw to no draw the 5 remaining sides, or otherwise this error will be thrown!
- 2: Non-Square Face
Breakable (brush):
Breakable (common):
|
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.