Plush

Ragdoll#

PlushEngine · Type index

Namespace: PlushEngine.Physics (using PlushEngine.Physics;)

Turns an animated character into a physical ragdoll on demand, in place. Put it on the object that has the Animation component. Until activated, the character plays its animation normally while kinematic bodies follow the pose (so shots, blasts and thrown objects still hit it). An impulse, a hard enough hit, Activate(), or StartRagdolled makes the bodies dynamic where they stand, carrying the velocity of the moment. From then on the skeleton is driven by the bodies; fingers and face bones keep their animation, following their parents. The object keeps its own transform (in-place ragdoll): the visual pose alone moves. Scale must be uniform.

public sealed class Ragdoll : Script

Members: Activate · ActivateWithVelocity · ActivationCount · AngularDamping · CenterOfMass · DriveLimb · Friction · HitShare · ImpulseLimb · IsActive · JointFriction · Layer · LimbPoint · LimbThickness · LinearDamping · Mass · OnAttach · ReleaseLimb · Reset · Restitution · Rig · SimulationEnabled · SkeletonRoot · StartRagdolled · Velocity · WakeImpulse · WakeOnImpact · WakeSpeed

Activate#

public bool Activate();

Go ragdoll at the next physics step. False when already ragdolled or not alive.

public bool Activate(Vector3 impulse);

Go ragdoll and shove the whole body with an impulse (N·s), whatever WakeImpulse says.

public bool Activate(Vector3 impulse, Vector3 worldPoint);

Go ragdoll and hit the segment nearest a world point with an impulse (see HitShare).

ActivateWithVelocity#

public bool ActivateWithVelocity(Vector3 velocity, Vector3 impulse, Vector3 worldPoint);

Explicit motor-to-ragdoll handoff. Enables simulation, seeds every body's linear velocity once, then applies the impact. Does not move or suspend the owning character root.

ActivationCount#

public int ActivationCount { get; }

How many times this character has gone ragdoll.

AngularDamping#

[DefaultValue(.15f)]
public float AngularDamping;

CenterOfMass#

public Vector3 CenterOfMass { get; }

Mass-weighted center of the bodies in world space (the object's own position until they exist). Aim blasts and shoves here.

DriveLimb#

public void DriveLimb(string limb, Vector3 localPoint, Vector3 target, float stiffness, float damping, float maxForce);

Force-limited spring for the next physics step only. Renew in BeforePhysics while holding. One drive per ragdoll; last request wins. Stiffness N/m, damping N/(m/s), maximum force N.

Friction#

[DefaultValue(.8f)]
public float Friction;

HitShare#

[DefaultValue(.5f)]
public float HitShare;

Share (0–1) of an impulse taken by the segment nearest the hit point (the limb that was struck); the rest shoves the whole body.

ImpulseLimb#

public bool ImpulseLimb(string limb, Vector3 impulse, Vector3 localPoint = default);

Impulse in N·s applied only to this active limb, at the specified body-local point. No whole-body hit sharing.

IsActive#

public bool IsActive { get; }

True while the bodies, not the animation, pose the skeleton.

JointFriction#

[DefaultValue(2f)]
public float JointFriction;

Resistance (N·m) each joint puts up against turning; higher settles faster and looks heavier.

Layer#

public CollisionLayerReference Layer;

Collision layer of every body, standing or ragdolled. Unset = the default layer.

LimbPoint#

public Vector3 LimbPoint(string limb, Vector3 localPoint = default);

World point on a named physical limb; localPoint is relative to its body center, in body axes/metres.

LimbThickness#

[DefaultValue(1f)]
public float LimbThickness;

Multiplies every capsule radius (collision volume only, not the visible mesh).

LinearDamping#

[DefaultValue(.02f)]
public float LinearDamping;

Mass#

[DefaultValue(70f)]
public float Mass;

Total body mass in kilograms, split across the segments.

OnAttach#

public override void OnAttach();

ReleaseLimb#

public void ReleaseLimb();

Reset#

public void Reset();

Stand back up: the animation poses the skeleton again from the object's own place.

Restitution#

[DefaultValue(0f)]
public float Restitution;

Rig#

public RagdollRig Rig;

SimulationEnabled#

[DefaultValue(true)]
public bool SimulationEnabled;

False removes all limb bodies and the physics pose on the next step. Useful for dormant death ragdolls under a character controller; this is not a partial-ragdoll blend.

SkeletonRoot#

public string SkeletonRoot;

Exact hierarchy path of the skeleton's root bone (see SkeletalAnimation.GetNodePath).

StartRagdolled#

[DefaultValue(false)]
public bool StartRagdolled;

Begin already ragdolled (a fallen character).

Velocity#

public Vector3 Velocity { get; }

Center-of-mass velocity of the ragdolled body; zero while standing.

WakeImpulse#

[DefaultValue(2f)]
public float WakeImpulse;

Smallest impulse (N·s) that ragdolls a standing character; smaller pushes are ignored.

WakeOnImpact#

[DefaultValue(true)]
public bool WakeOnImpact;

A standing character goes ragdoll when a movable object touches it faster than WakeSpeed.

WakeSpeed#

[DefaultValue(2f)]
public float WakeSpeed;

Closing speed (m/s) along the contact normal that counts as a hit.

CollisionLayerReference · RagdollRig · Script

Source#