自制游戏世界里可破坏物品
< Zh
Jump to navigation
Jump to search
默认情况下,一个 propdata 允许其在生命值 (health) 降至零时破碎 (break) 的模型,会根据其基础类型 (base_type) 材质生成一堆通用碎片 (generic gibs)。虽然这能省点事,但远不如使用一套看起来就像是你的可破坏模型一部分的自定义碎片 (custom gibs) 来得令人满意。
建模
- 使用原始模型作为参考,并将碎片放置在其上。
- 分别导出每个碎片。
编译
每个碎片
$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
}
可破坏模型
- 在
.QC文件中添加$collisiontext部分
$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 选项
- model
- ragdoll
- offset
- health
- fadetime
- fademindist
- fademaxdist
- debris
- burst
- placementbone
- placementattachment
- motiondisabled (l4d2新增?)
-用于在 dead-center 关卡旅馆的窗格破碎后,在窗框边缘生成不会移动的玻璃碎片
- break { "model" "props_windows\hotel_glass_frame002.mdl" "health" "0" "fadetime" "0" "motiondisabled" "1" "multiplayer_break" "both"}