Creating custom gibs
By default, a model whose propdata allows it to break when its health reaches zero, will spawn a bunch of generic gibs according to its base_type material. Whilst this saves a bit of work, it not nearly as satisfying as using a set of custom gibs that actually look like parts of your breakable model.
Modeling
- Use the original model as a reference, and place gibs over it.
- Export each gib separately
Compiling
Each gib
$scale 1.0 $modelname trashcan\trashcan_piece_a.mdl $keyvalues { "prop_data" { "base" "Wooden.Small" "health" "0" } } //Health 0 makes it invulnerable. Not having this or setting it to another value allows the gib to be busted into more gibs. Small wood bits, in this case. $body studio "trashcan_piece_a" $cdmaterials models\trashcan $staticprop $surfaceprop "wood" //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. $sequence idle "trashcan_piece_a" loop fps 15 $origin -24.043 -24.066 2.166 0 // values are X Y Z rotationZ, without they will spawn in one large heap if their origins are the same. If the objects are exported at non-origin values they would spawn there, unless this is called. $collisionmodel "trashcan_piece_a_collision.SMD" { $automass }
Breakable model
- Add
$collisiontext
section to the.QC
file
$scale 1.0 $modelname trashcan\trashcan_breakable.mdl $body "Body" "trashcan.smd" $cdmaterials models\trashcan $surfaceprop "wood" //Important! Make sure the $surfaceprop type matches the "base" in $keyvalues, or you get nothing. $sequence idle "trashcan" loop fps 15 $keyvalues { "prop_data" { "base" "Wooden.Medium" "health" "10"} } //Health is the damage required to break the item, 0 will make it invincible. $collisiontext { break { "model" "trashcan/trashcan_piece_a.mdl" "fadetime" "15" } break { "model" "trashcan/trashcan_piece_b.mdl" "fadetime" "15" } } $collisionmodel "trashcan_collision.SMD" { $concave $mass 100.000 }
- break options
- model
- ragdoll
- offset
- health
- fadetime
- fademindist
- fademaxdist
- debris
- burst
- placementbone
- placementattachment
- motiondisabled (new with l4d2?)
-used to spawn the non-moving chips of glass around the edges of the window panes in dead-center's hotel after they were broken
- break { "model" "props_windows\hotel_glass_frame002.mdl" "health" "0" "fadetime" "0" "motiondisabled" "1" "multiplayer_break" "both"}