Prop ragdoll: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m ({{Code}} to {{Codenote}})
mNo edit summary
Line 7: Line 7:
{{warning|This entity generates server-side ragdolls, which collide with everything but produce very large amounts of network traffic. Use in single-player only!}}
{{warning|This entity generates server-side ragdolls, which collide with everything but produce very large amounts of network traffic. Use in single-player only!}}


{{bug|In [[Portal 2]], ragdolls cannot pass through portals.}}
{{bug|In [[Portal 2]], ragdolls cannot pass through portals. This often occurs in Portal as well}}
:: {{todo|Check to see if it works in the original [[Portal]].}}


{{altnames|name1=physics_prop_ragdoll}}
{{altnames|name1=physics_prop_ragdoll}}

Revision as of 04:05, 23 September 2020

For details on creating a ragdoll, see $collisionjoints.
prop_ragdoll can interact with dynamic objects, unlike death ragdolls.

Template:Base point It is a VPhysics ragdoll. Ragdolls are collections of physics objects constrained together to simulate a jointed object like a dead body. They are very expensive to simulate.

Warning.pngWarning:This entity generates server-side ragdolls, which collide with everything but produce very large amounts of network traffic. Use in single-player only!
Icon-Bug.pngBug:In Portal 2, ragdolls cannot pass through portals. This often occurs in Portal as well  [todo tested in ?]
AltNames.pngAltNames: This entity is also tied to physics_prop_ragdoll.
C++ In code, it is represented by theCRagdollPropclass, defined in thephysics_prop_ragdoll.cppfile.

See also Prop Types Overview.

Death ragdolls/ragdoll transformation

When a NPC/player dies or an entity receives the BecomeRagdoll input, it normally creates a client-side ragdoll and copies most of its animation and visual data to it. Unlike server-side prop_ragdolls, 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. worldspawn).

However, a NPC will become a server-side ragdoll while it's under any of the following conditions:

These server-side death ragdolls will collide with physics objects and beyond, like any prop_ragdoll, but they are marked as debris and do not collide with each other. They do not collide with themselves either, unlike client-side ragdolls. This is believed to be intentional behavior to reduce performance/networking costs.

Note.pngNote:Most of this list theoretically applies to players as well, although that hasn't been tested.
Warning.pngWarning:While most of the relevant animation/visual data is copied to ragdolls, some fields, like fade distances, are not transferred.
Cpp.pngCode:This can be modified at CBaseAnimating::CopyAnimationDataFrom() in baseanimating.cpp for server-side ragdolls and C_BaseAnimating::CreateRagdollCopy() in c_baseanimating.cpp for client-side ragdolls.

Keyvalues

sequence ([todo internal name (i)]) <integer> !FGD
The ragdoll will be moved to the first frame of this animation before VPhysics takes over.
Icon-Bug.pngBug:Doesn't function.  [todo tested in ?]
body ([todo internal name (i)]) <integer> !FGD
Specifies which body group should be used.
Override Animation ([todo internal name (i)]) <string>
Filled in by the engine via wc_update_entity. Do not edit by hand except to clear.
Minimum / Maximum DX Level (mindxlevel / maxdxlevel) <integer choices> (removed since Left 4 Dead)
The entity will not exist if the engine is running outside the given range of DirectX Versions.
Choices
Warning.pngWarning:If these are used, the object may break when the user switches their DirectX settings.[missing string]
Minimum / Maximum Effect Details Level (mincpulevel / maxcpulevel) <integer choices> (in all games since Left 4 Dead)
Don't render for players with Effect Details levels that exceed the minimum or maximum.
Choices
  • 0: Default ("Low" for mincpulevel, "High" for maxcpulevel)
  • 1: Low
  • 2: Medium
  • 3: High
Minimum / Maximum Shader Details Level (mingpulevel / maxgpulevel) <integer choices> (in all games since Left 4 Dead)
Don't render for players with Shader Details levels that exceed the minimum or maximum.
Choices
  • 0: Default ("Low" for mingpulevel, "Very High" for maxgpulevel)
  • 1: Low
  • 2: Medium
  • 3: High
  • 4: Very High
See also:  cpu_level / gpu_level convars

CBaseAnimating:

World Model (model) <model path>
The model this entity should appear as. 128-character limit.
Skin (skin) <integer>
Some models have multiple skins. This value selects from the index, starting with 0. May be overridden by game code.
Tip.pngTip:Hammer's model browser automatically updates this value if you use it to view different skins.
Model Scale (modelscale) <float> (in all games since Alien Swarm) (also in Source 2013)
A multiplier for the size of the model.
Tip.pngTip:In Hammer++ Hammer++ with a prop selected in 3D view, hold Ctrl and scroll the mouse wheel to change the modelscale in increments of 0.5. Holding Shift will scale it in smaller increments of 0.05.
Bodygroup (body / SetBodyGroup) <integer>
Some models have multiple submodels. This value selects from the index, starting with 0. May be overridden by animations and/or game code.
Note.pngNote:If both body and SetBodyGroup are present (even if set to 0), body will be prioritized.
Sequence (sequence) <integer> !FGD
Default animation sequence for the model to be playing after spawning. May be overridden by game code.
Lighting Origin (lightingorigin) <targetname>
Select an entity (not info_lighting!) from which to sample lighting and cubemaps instead of the entity's $illumposition.

Shadow:

Disable Shadows (disableshadows) <boolean>
Prevents the entity from creating cheap render-to-texture shadows, or lightmap shadows if the entity is a prop_static. Does not affect shadow mapping.
Disable Receiving Shadows (disablereceiveshadows) <boolean>
Prevent the entity from receiving dynamic shadows on itself.
Shadow Cast Distance (shadowcastdist) <integer> !FGD
Sets how far the entity casts dynamic shadows. 0 means default distance from the shadow_control entity.
Disable Shadow Depth (disableshadowdepth) <boolean> (in all games since Portal 2)
Used to disable rendering into shadow depth (for projected textures) for this entity.
Disable flashlight (disableflashlight) <boolean> (in all games since Portal 2)
Used to disable projected texture lighting and shadows on this entity.
Projected Texture Cache (shadowdepthnocache) <integer choices> (in all games since Portal 2)
Used to hint projected texture system whether it is sufficient to cache shadow volume of this entity or to force render it every frame instead.
Choices
  • 0 : Default
  • 1 : No cache - render every frame
  • 2 : Cache it - render only once
Render in Fast Reflections (drawinfastreflection) <boolean> (in all games since Portal 2)
If enabled, this entity will render in fast water reflections (i.e. when a water material specifies $reflectonlymarkedentities) and in the world impostor pass.
Pitch Yaw Roll (Y Z X) (angles) <QAngle>
This entity's orientation in the world. Pitch is rotation around the Y axis, yaw is the rotation around the Z axis, roll is the rotation around the X axis.

BaseFadeProp:

Start Fade Dist (fademindist) <float>
Distance at which the entity starts to fade.
End Fade Dist (fademaxdist) <float>
Max fade distance at which the entity is visible.
  • If start fade is <0, the entity will disappear instantly when end fade is hit.
  • If end fade is <0, the entity won't disappear at all. (This is the default behavior.)
The values will scale appropriately if the entity is in a 3D Skybox.
Fade Scale (fadescale) <float>
If you specify so in worldspawn, or if the engine is running below DirectX 8 (DX7 in Source 2006), props will fade out even if the fade distances above aren't specified. This value gives you some control over when this happens: numbers smaller than 1 cause the prop to fade out at further distances, while those greater than 1 cause it to fade out at closer distances. Using 0 turns off the forced fade altogether. See also the QC command $noforcedfade.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

GMODSandbox:

Allow Physics Gun (gmod_allowphysgun) <boolean> (only in Garry's Mod)
If set, players cannot use Physics Gun on this entity.
Sandbox Tool Whitelist (gmod_allowtools) <string> (only in 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

  • 4 : Debris - Don't collide with the player or other debris
  • 8192 : Allow Dissolve
  • 16384 : Motion Disabled
  • 32768 : Allow stretch
  • 65536 : Start asleep

Inputs

StartRagdollBoogie
Begins ragdoll boogie effect for 5 seconds.
Icon-Bug.pngBug: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.  [todo tested in ?]
Cpp.pngCode Fix:In CRagdollProp's data description, find DEFINE_INPUTFUNC( FIELD_VOID, "StartRagdollBoogie", InputStartRadgollBoogie ) and replace FIELD_VOID with FIELD_FLOAT.
EnableMotion, DisableMotion
Enable/disable physics simulation.
FadeAndRemove  (in all games since Half-Life 2: Episode Two)
Fade out then remove (kill) self. Parameter override = duration of fade.
Ignite  !FGD
Set on fire.
SetBodyGroup  !FGD
Change the current body group.

RenderFields:

Alpha <integer 0–255>
Sets the entity's transparency to a number from 0 (invisible) to 255 (fully visible). Requires the entity to have its rendermode set to a number other than 0.
Color <color255RedirectInput/color32>
Sets an RGB color for the entity.
Studiomodel:
Skin <integerRedirectInput/integer>
Changes the model's skin to the specified number.
SetBodyGroup <integerRedirectInput/integer>
Set the model's body group.
AlternativeSorting <booleanRedirectInput/boolean>
Uses an alternative method for telling which objects are in front of others. Use if this object draws incorrectly when seen through transparent things.
SetModelScale <stringRedirectInput/string> (in all games since Alien Swarm) (also in Source 2013)
Sets the model scale. Takes two values separated by a space. The first is the target model scale. The second value is the number of seconds the change in scale will be spread over. If there is no second value, the model will scale instantly.
Warning.pngWarning:Negative or extremely high values can cause crashes!

Shadow:

DisableShadow
Turn dynamic shadows off for this entity. Identical to applying  EF_NOSHADOW.
EnableShadow
Turn dynamic shadows on for this entity.
DisableReceivingFlashlight  (in all games since Portal 2)
This object will not receive light or shadows from projected textures.
EnableReceivingFlashlight  (in all games since Portal 2)
This object may receive light or shadows from projected textures.

Reflection:

DisableDrawInFastReflection  (in all games since Portal 2)
Turns off rendering of this entity in reflections when using $reflectonlymarkedentities in water material.
EnableDrawInFastReflection  (in all games since Portal 2)
Turn on rendering of this entity in reflections when using $reflectonlymarkedentities in water material.
ToggleDraw:
DisableDraw  (in all games since Portal 2)
Add the EF_NODRAW flag to this entity. Some entities manage this on their own so be aware you can override that value.
EnableDraw  (in all games since Portal 2)
Remove the EF_NODRAW flag from this entity. Some entities manage this on their own so be aware you can override that value.

Outputs