这篇条目有关 Source引擎。如需详情,点击这里。

Zh/Prop ragdoll: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
m (→‎Inputs: Substituted IO templates)
 
(13 intermediate revisions by 2 users not shown)
Line 7: Line 7:
{{warning|该实体生成的是服务端布娃娃,会与任何道具发生碰撞,但这会造成大量网络开销。通过默认休眠(勾选Start asleep Flag),禁用物理运动或禁用与动态道具的碰撞({{not in FGD}}在soild键值中使用0为参数),并仅在需要时启用物理运动,可以显著减少网络开销}}
{{warning|该实体生成的是服务端布娃娃,会与任何道具发生碰撞,但这会造成大量网络开销。通过默认休眠(勾选Start asleep Flag),禁用物理运动或禁用与动态道具的碰撞({{not in FGD}}在soild键值中使用0为参数),并仅在需要时启用物理运动,可以显著减少网络开销}}
{{bug|通过Hammer设置自定义动作并勾选<code>Start Asleep</code> Flag会导致渲染框无法更新,在生成时唤醒布娃娃一帧时间后再次休眠即可解决此问题}}
{{bug|通过Hammer设置自定义动作并勾选<code>Start Asleep</code> Flag会导致渲染框无法更新,在生成时唤醒布娃娃一帧时间后再次休眠即可解决此问题}}
{{bug|在{{Portal2|4}}中,布娃娃无法穿过传送门,这也在{{Portal|4}}中经常发生}}
{{bug|在{{Portal2|4}}中,布娃娃无法穿过传送门,这也在{{Portal|4}}中经常发生|hidetested=1}}
{{bug|[[Prediction|预测]]时会忽略布娃娃,这会在触摸布娃娃时导致大量的预测错误}}
{{bug|[[Prediction|预测]]时会忽略布娃娃,这会在触摸布娃娃时导致大量的预测错误}}
{{altnames|name1=physics_prop_ragdoll}}
{{altnames|name1=physics_prop_ragdoll}}
Line 18: Line 18:
* <code>prop_ragdoll_original</code>有真实的子弹推力效果
* <code>prop_ragdoll_original</code>有真实的子弹推力效果
}}
}}
{{bug|<br/>
{{bug|
* server side ragdolls created by NPCs never gib before loading save since the first Steam version, the same for gibs created by gibbed ragdolls.  Use [https://community.lambdageneration.com/black-mesa/post/efesc2f8cyf the workshop addon] if you want to use server side ragdolls in your mod.
* 自Steam首发版本开始,除非进行存读档,NPC尸体转换成的服务端布娃娃无法被碎尸,已碎尸的布娃娃创建的尸块也是如此,如果你需要在mod中使用服务端布娃娃,请使用[https://community.lambdageneration.com/black-mesa/post/efesc2f8cyf 该插件]
* crowbar's raycast skips/ignores server side ragdolls since the first [[Steam]] version.
* 自Steam首发版本开始,撬棍的攻击判定会无视/跳过服务端布娃娃
* Tripmines do not gib ragddols
* 拌雷的爆炸不会导致碎尸
* In multiplayer ragdolls do not create hole decals and blood from bullets if <code>[4] Debris</code> spawnflag is enabled. If this flag is disabled - ragdolls still will not create blood effects and hand blood overlays.}}
* 在多人模式中,在Spawnflags勾选<code>[4] Debris</code>的布娃娃不会生成印花纹理和血迹,如果禁用此Flag,布娃娃仍然不会生成血液特效和在玩家的手臂模型上生成血迹}}
}}
}}




==Death Ragdolls/Ragdoll Transformation==
==尸体布娃娃/布娃娃转换==
When a NPC/player dies or an entity receives the <code>BecomeRagdoll</code> input, it normally creates a '''client-side''' ragdoll and copies most of its animation and visual data to it. Unlike server-side <tt>prop_ragdoll</tt>s, these client-side ragdolls are handled completely on a per-client basis and are ''much'' cheaper and simpler than their server-side counterparts, at the expense of being virtually nonexistent on the server, being inconsistent across client perspectives, and only colliding with entities that have physics objects on the client (e.g. {{ent|mode=name|worldspawn}}).
在NPC/玩家死亡,或者接收到<code>BecomeRagdoll</code>输入的情况下,通常会创建一个'''客户端'''布娃娃,并将大部分动画和视觉数据复制到其中。与<tt>服务端</tt>布娃娃不同的是,这些客户端布娃娃完全基于每个客户端进行处理,在性能开销方面比服务端布娃娃要廉价,简单的多,但代价是在服务端上几乎不存在,在客户端的视角之间存在不一致,并且只会与在客户端上具有物理属性的道具互动(比如{{ent|mode=name|worldspawn}}


However, a NPC will become a server-side ragdoll while it's under any of the following conditions:
然而,当NPC处于以下任意一种情况时,其会变成服务端布娃娃
* The NPC is inside the volume of a {{ent|mode=name|trigger_serverragdoll}}
* NPC位于{{ent|mode=name|trigger_serverragdoll}}体积内
* The NPC is killed by a vehicle in singleplayer
* NPC在单人模式中被玩家的载具撞死
* The [[weapon_physcannon|gravity gun]] is supercharged
* [[weapon_physcannon|重力枪]]处于充能状态
* The NPC dies on fire while in [[env_global|Alyx darkness mode]]
* [[env_global|Alyx darkness mode]]开启时,NPC被烧死
* The NPC is a vital ally (e.g., {{ent|mode=name|npc_alyx}})
* NPC是重要队友(比如{{ent|mode=name|npc_alyx}}
These server-side death ragdolls will collide with physics objects and beyond, like any <tt>prop_ragdoll</tt>, but they are marked as debris and do not collide with each other. They do not collide with ''themselves'' either, unlike client-side ragdolls (fixed in {{ez2|4}} and {{bms|4}}). This is believed to be intentional behavior to reduce performance/networking costs.
<tt>prop_ragdoll</tt>一样,这些服务端的尸体布娃娃会与物理道具和其他东西发生碰撞,但它们被标记为<code>debris</code>,不会互相产生碰撞,不像客户端布娃娃,它们也不会与''自身''产生碰撞(已在{{ez2|4}}{{bms|4}}中被修复)。这通常被认为是有意为之,皆在减少性能/网络开销
{{bug|Server side ragdolls don't save blood decals. Fixed in {{mapbase|4}} and {{bms|4}}.}}
{{bug|服务端布娃娃不会保存血液印花,已在{{mapbase|4}}{{bms|4}}中被修复}}
{{note|Most of this list ''theoretically'' applies to players as well, although that hasn't been tested.}}
{{note|以上的大部分内容虽尚未进行进一步的测试,但'''理论上'''也适用与玩家}}


{{warning|While most of the relevant animation/visual data is copied to ragdolls, some fields, like fade distances, are not transferred.}}
{{warning|虽然大部分的动画/视觉数据都被复制到了客户端布娃娃上,但诸如淡入/淡出距离一类的数据并没有被复制}}
: {{codenote|This can be modified at <code>CBaseAnimating::CopyAnimationDataFrom()</code> in <code>baseanimating.cpp</code> for server-side ragdolls and <code>C_BaseAnimating::CreateRagdollCopy()</code> in <code>c_baseanimating.cpp</code> for client-side ragdolls.}}
: {{codenote|对于服务端布娃娃,可以修改<code>baseanimating.cpp</code>中的<code>CBaseAnimating::CopyAnimationDataFrom()</code>,而对于客户端布娃娃,则可以修改<code>c_baseanimating.cpp</code>中的<code>C_BaseAnimating::CreateRagdollCopy()</code>}}


==Keyvalues==
==Keyvalues==
{{KV Targetname}}
{{KV Targetname}}
{{KV|Override Animation|intn=angleOverride|string|Filled in by the engine via [[hammer_update_entity]]. Do not edit by hand except to clear.}}
{{KV|Override Animation|intn=angleOverride|string|以<code>index,x y z,...</code>为格式表示的关节旋转列表,由引擎通过[[hammer_update_entity]]指令或{{Hammer++|4}}的物理模拟工具填充。除非需要清空,否则不要手动修改}}
{{Expand|title=Non-Valve game specific|
{{Expand|title=非V社游戏特定内容 {{gmod}}{{bms}}|
{{KV|Health|intn=health|integer|The amount of damage the ragdoll takes before gibbing.|only=BMS}}
{{KV|Health|intn=health|integer|布娃娃要被碎尸所需受到的伤害值|only=BMS|also={{Entropy : Zero 2|4}}}}
{{KV|Character Manifest Mimic Name|intn=MimicName|string|Choose a name or a classname from the character manifest to dress the ragdoll.|only=BMS}}   
{{KV|Character Manifest Mimic Name|intn=MimicName|string|从角色清单中选择一个名字或实体类名来给布娃娃穿衣|only=BMS}}  <!--谁能给我解释下这什么意思-->
{{KV GMOD}}
{{KV GMOD}}
}}
}}


==Flags==
==Flags==
{{fl|4|Debris|Don't collide with the player or other debris}}
{{fl|4|Debris|不会与玩家或其他碎片交互}}
{{fl|4096|Use 'Least Recently Used' Retirement {{clarify}} }} {{Not in FGD}}
{{fl|4096|Use 'Least Recently Used' Retirement|{{Not in FGD}}使用LRU机制,“LRU”指的是起源的布娃娃清理系统,该系统会自动删除未使用的布娃娃。由NPC生成的服务端布娃娃会自动添加到此系统中,但是由地图制作者放置的布娃娃不会}}
{{fl|8192|Allow Dissolve}}
{{fl|8192|Allow Dissolve|允许被分解}}
{{fl|16384|Motion Disabled}}
{{fl|16384|Motion Disabled|禁用物理运动}}
{{fl|32768|Allow stretch}}
{{fl|32768|Allow stretch|允许拉伸}}
{{fl|65536|Start asleep}}
{{fl|65536|Start asleep|默认休眠}}


==Inputs==
==Inputs==
{{IO|StartRagdollBoogie|Begins ragdoll boogie effect for 5 seconds.{{bugfix|This input is actually supposed to use a parameter for how long the ragdoll should boogie, but it uses the wrong field type in the data description.|In <code>CRagdollProp</code>'s data description, find <code>DEFINE_INPUTFUNC( FIELD_VOID, "StartRagdollBoogie", InputStartRadgollBoogie )</code> and replace <code>FIELD_VOID</code> with <code>FIELD_FLOAT</code>.|code}}}}
{{I|StartRagdollBoogie|开始布娃娃抖动效果,持续5秒{{bugfix|这个输入实际上应该使用一个参数来指定抖动时长,但在代码中的数据类型描述时使用了错误的字段类型|<code>CRagdollProp</code>的数据类型中,查找<code>DEFINE_INPUTFUNC( FIELD_VOID, "StartRagdollBoogie", InputStartRadgollBoogie )</code>并将<code>FIELD_VOID</code>替换为<code>FIELD_FLOAT</code>.|code}}}}
{{IO|EnableMotion / DisableMotion|Enable / disable physics simulation.}}
{{I|EnableMotion / DisableMotion|启用/禁用物理运动}}
{{IO|FadeAndRemove|Fade out then remove (kill) self. Parameter override <nowiki>=</nowiki> duration of fade.|since={{hl2ep2}}}}
{{I|FadeAndRemove|淡出并删除自身,附加参数<nowiki>=</nowiki>淡出所需时间|since={{hl2ep2}}}}
{{IO|AllowBloodPool|Сorpse once will create pool of blood (particle effect) if it is placed on brush. {{note|Not avaible for <code>prop_ragdoll_original</code> and <code>prop_ragdoll_attached</code>.}}|nofgd=1|only={{bms}}}}
{{I|AllowBloodPool|如果放置在固体上,则会产生一摊血迹(粒子特效){{note|不适用于<code>prop_ragdoll_original</code><code>prop_ragdoll_attached</code>.}}|nofgd=1|only={{bms}}}}


== See Also ==
== 参见 ==
* {{ent|env_ragdoll_boogie}}
* {{ent|env_ragdoll_boogie}}
* [[Prop Types Overview]]
* [[Prop Types Overview]]

Latest revision as of 11:29, 21 April 2025

English (en)中文 (zh)Translate (Translate)
参见:  有关创建布娃娃的具体细节,详见$collisionjoints.
C++ 类层级
CRagdollProp
CBaseAnimating
CBaseEntity
C++ physics_prop_ragdoll.cpp
不像NPC死亡时生成的布娃娃,地图制作者放置的布娃娃可以与环境动态的交互

prop_ragdoll是一个点实体(en),可在所有的 起源 起源 游戏中使用。是一个具有物理性质布娃娃。布娃娃是一组约束在一起的物理对象的集合,用于模拟像尸体这样的关节物体,它们的物理模拟有着昂贵的性能开销.

Warning.png警告:该实体生成的是服务端布娃娃,会与任何道具发生碰撞,但这会造成大量网络开销。通过默认休眠(勾选Start asleep Flag),禁用物理运动或禁用与动态道具的碰撞(不存在于FGD!在soild键值中使用0为参数),并仅在需要时启用物理运动,可以显著减少网络开销
Icon-Bug.png错误:通过Hammer设置自定义动作并勾选Start Asleep Flag会导致渲染框无法更新,在生成时唤醒布娃娃一帧时间后再次休眠即可解决此问题  [todo tested in ?]
Icon-Bug.png错误:传送门2 传送门2中,布娃娃无法穿过传送门,这也在传送门 传送门中经常发生
Icon-Bug.png错误:预测时会忽略布娃娃,这会在触摸布娃娃时导致大量的预测错误  [todo tested in ?]
AltNames.pngAltNames: 此实体也绑定到 physics_prop_ragdoll
黑山 黑山特定提示和漏洞
Note.png注意:原始版本仍可作为prop_ragdoll_original使用。区别在于:
  • prop_ragdoll_original无法通过爆炸造成碎尸
  • 如果没有在Spawnflags勾选[4] Debris,撬棍的攻击可以击中prop_ragdoll_original(由于某些原因,撬棍的攻击判定会跳过prop_ragdoll
  • prop_ragdoll_original没有流血效果且不会产生印花
  • prop_ragdoll_original无法被拾取
  • prop_ragdoll_original有真实的子弹推力效果
Icon-Bug.png错误:
  • 自Steam首发版本开始,除非进行存读档,NPC尸体转换成的服务端布娃娃无法被碎尸,已碎尸的布娃娃创建的尸块也是如此,如果你需要在mod中使用服务端布娃娃,请使用该插件
  • 自Steam首发版本开始,撬棍的攻击判定会无视/跳过服务端布娃娃
  • 拌雷的爆炸不会导致碎尸
  • 在多人模式中,在Spawnflags勾选[4] Debris的布娃娃不会生成印花纹理和血迹,如果禁用此Flag,布娃娃仍然不会生成血液特效和在玩家的手臂模型上生成血迹  [todo tested in ?]


尸体布娃娃/布娃娃转换

在NPC/玩家死亡,或者接收到BecomeRagdoll输入的情况下,通常会创建一个客户端布娃娃,并将大部分动画和视觉数据复制到其中。与服务端布娃娃不同的是,这些客户端布娃娃完全基于每个客户端进行处理,在性能开销方面比服务端布娃娃要廉价,简单的多,但代价是在服务端上几乎不存在,在客户端的视角之间存在不一致,并且只会与在客户端上具有物理属性的道具互动(比如worldspawn

然而,当NPC处于以下任意一种情况时,其会变成服务端布娃娃

prop_ragdoll一样,这些服务端的尸体布娃娃会与物理道具和其他东西发生碰撞,但它们被标记为debris,不会互相产生碰撞,不像客户端布娃娃,它们也不会与自身产生碰撞(已在Entropy : Zero 2 Entropy : Zero 2黑山 黑山中被修复)。这通常被认为是有意为之,皆在减少性能/网络开销

Icon-Bug.png错误:服务端布娃娃不会保存血液印花,已在Mapbase Mapbase黑山 黑山中被修复  [todo tested in ?]
Note.png注意:以上的大部分内容虽尚未进行进一步的测试,但理论上也适用与玩家
Warning.png警告:虽然大部分的动画/视觉数据都被复制到了客户端布娃娃上,但诸如淡入/淡出距离一类的数据并没有被复制
Cpp.png代码:对于服务端布娃娃,可以修改baseanimating.cpp中的CBaseAnimating::CopyAnimationDataFrom(),而对于客户端布娃娃,则可以修改c_baseanimating.cpp中的C_BaseAnimating::CreateRagdollCopy()

Keyvalues

Name (目标名称) <target_source>[ Edit ]
这个名称是其他实体通过 输入/输出(en) 或其他 关键值(en)(如 parentnametarget) 来引用该实体时使用的标识符。
该名称也会显示在 Hammer 编辑器的 2D 视图和 实体报告(en) 中。
参见:  所有实体均可使用的 通用键值、输入与输出(en)

Override Animation (angleOverride) <字符串(en)>
index,x y z,...为格式表示的关节旋转列表,由引擎通过hammer_update_entity指令或Hammer++ Hammer++的物理模拟工具填充。除非需要清空,否则不要手动修改
非V社游戏特定内容 Garry's Mod黑山
Health (health) <整数(en)> (存在于 黑山 之中) (也存在于 Entropy : Zero 2 Entropy : Zero 2 之中)
布娃娃要被碎尸所需受到的伤害值
Character Manifest Mimic Name (MimicName) <字符串(en)> (存在于 黑山 之中)
从角色清单中选择一个名字或实体类名来给布娃娃穿衣

GMODSandbox:

Allow Physics Gun (gmod_allowphysgun) <布尔值(en)> (存在于 Garry's Mod 之中)
If set, players cannot use Physics Gun on this entity.
Sandbox Tool Whitelist (gmod_allowtools) <字符串(en)> (存在于 Garry's Mod 之中)
If set, only given tools can be used on this entity. You need to supply the tool class names, the names of the .lua files of those tools. This also includes the context menu properties!

Flags

Debris : [4]
不会与玩家或其他碎片交互
Use 'Least Recently Used' Retirement : [4096]
不存在于FGD!使用LRU机制,“LRU”指的是起源的布娃娃清理系统,该系统会自动删除未使用的布娃娃。由NPC生成的服务端布娃娃会自动添加到此系统中,但是由地图制作者放置的布娃娃不会
Allow Dissolve : [8192]
允许被分解
Motion Disabled : [16384]
禁用物理运动
Allow stretch : [32768]
允许拉伸
Start asleep : [65536]
默认休眠

Inputs

StartRagdollBoogie
开始布娃娃抖动效果,持续5秒
Icon-Bug.png错误:这个输入实际上应该使用一个参数来指定抖动时长,但在代码中的数据类型描述时使用了错误的字段类型  [todo tested in ?]
Cpp.png代码修复:CRagdollProp的数据类型中,查找DEFINE_INPUTFUNC( FIELD_VOID, "StartRagdollBoogie", InputStartRadgollBoogie )并将FIELD_VOID替换为FIELD_FLOAT.
EnableMotion / DisableMotion
启用/禁用物理运动
FadeAndRemove  (存在于自 半衰期2:第二章 以来)
淡出并删除自身,附加参数=淡出所需时间
AllowBloodPool  (存在于 黑山 之中) 不存在于FGD!
如果放置在固体上,则会产生一摊血迹(粒子特效)
Note.png注意:不适用于prop_ragdoll_originalprop_ragdoll_attached.

参见