自制游戏世界里可破坏物品

From Valve Developer Community
< Zh
Revision as of 23:33, 3 October 2025 by 世凪Yonagi (talk | contribs) (Created page with "{{LanguageBar|title = 自制游戏世界里可破坏物品}} {{stub}} {{ACategory|Modeling}} 默认情况下,一个 {{L|propdata}} 允许其在''生命值'' (health) 降至零时''破碎'' (break) 的模型,会根据其''基础类型'' (base_type) 材质生成一堆''通用碎片'' (generic gibs)。虽然这能省点事,但远不如使用一套看起来就像是你的可破坏模型一部分的''自定义碎片'' (custom gibs) 来得令人满意。 ==建模== *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
English (en)中文 (zh)Translate (Translate)

小作品

This article or section is a stub. You can help by expanding it.

默认情况下,一个 propdata(en) 允许其在生命值 (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
   }

可破坏模型

   $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"}

另见