Ragdoll Class |
Namespace: DigitalRune.Physics.Specialized
The Ragdoll type exposes the following members.
Name | Description | |
---|---|---|
AddToSimulation |
Adds all parts of the ragdoll to a simulation.
| |
CreateAvatarRagdoll(AvatarPose, Simulation) |
Creates a Ragdoll for an Xbox LIVE Avatar. (Only available on Xbox 360.)
| |
CreateAvatarRagdoll(Skeleton, Simulation) |
Creates a Ragdoll for an Xbox LIVE Avatar. (Only available on Xbox 360.)
| |
DisableJoints |
Disables all joints.
| |
DisableLimits |
Disables all limits.
| |
DisableMotors |
Disables all motors.
| |
DriveToPose(SkeletonPose, Single) |
Drives the ragdoll bodies to the target pose using the Motors.
| |
DriveToPose(SkeletonPose, TimeSpan) |
Drives the ragdoll bodies to the target pose using the Motors.
| |
EnableJoints |
Enables all joints.
| |
EnableLimits |
Enables all limits.
| |
EnableMotors |
Enables all motors.
| |
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RemoveFromSimulation |
Removes all ragdoll parts from the simulation.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UpdateBodiesFromSkeleton |
Updates the poses of the bodies, so that the bodies match the bone transforms of the given
skeleton pose.
| |
UpdateBodyFromSkeleton |
Updates the pose of a single body, so that the bodies match the bone transforms of the given
bone.
| |
UpdateSkeletonFromBodies |
Updates the bone transforms of the skeleton pose, so that the bones match the ragdoll
bodies.
|
Name | Description | |
---|---|---|
Bodies |
Gets the rigid bodies that represent the ragdoll limbs.
| |
BodyOffsets |
Gets the body offsets.
| |
Joints |
Gets the joints.
| |
Limits |
Gets the limits.
| |
Motors |
Gets the motors.
| |
Pose |
Gets or sets the pose (position and orientation) of the character in world space.
| |
Simulation |
Gets the simulation to which this ragdoll was added.
|
A ragdoll represents a 3D animated character in the physics engine. To define a ragdoll you need several Bodies that represent the limbs of a character. In many cases, rigid bodies are only created for the important bones of the character skeleton. The rigid bodies are connected using constraints, e.g. BallJoints, HingeJoints, etc. See property Joints. Limits are constraints that restrict the relative movement of limbs to avoid unrealistic poses. Motors can be used to control the ragdoll pose.
The Ragdoll class is a container for all the parts of a ragdoll (bodies, joints, limits, motors, etc.). When AddToSimulation(Simulation) is called, all relevant parts are added to the physics Simulation and the ragdoll simulation starts. RemoveFromSimulation must be called to stop the ragdoll simulation and/or when the ragdoll is no longer needed.
UpdateBodiesFromSkeleton(SkeletonPose) takes a skeleton and moves the ragdoll bodies so that they match the skeleton pose. This method instantly moves ("teleports") the bodies to their new positions. When this method is used, the bodies do not smoothly interact with other physics objects. This method is usually only used to initialize the rigid body positions when the ragdoll is added to the simulation.
UpdateSkeletonFromBodies(SkeletonPose) animates a SkeletonPose so that it matches the ragdoll posture. If a skeleton should be animated by the physics system, then this method must be called in each frame.
DriveToPose(SkeletonPose, Single) uses motors to control the movement of the bodies. This method must be used if the ragdoll should interact with other physics objects, or if an animation should be blended with the physically-based movement.
While a ragdoll is added to a simulation, it is not allowed to add or remove Bodies, Joints, Limits or Motors.
Ragdoll creation:
The ragdoll does not contain helper methods for ragdoll creation. To create the ragdoll rigid
bodies must be added to Bodies. The order of the rigid bodies is important
because the index in this list determines with which skeleton bone the body will be
associated. This list can contain entries (often bodies are only
created for important bones). It is allowed that this list has less or more entries than the
number of bones. Offsets can be added to BodyOffsets. The order of
BodyOffsets is the same as for Bodies. If no offsets are set the
bodies are centered at the bone origins.
Constraints that connect the rigid bodies should be added to the Joints list. The joints in this list can have any order. Typically, a BallJoint is created at each bone origin to connect the body of a bone with the body of the parent bone.
Constraints that restrict the allowed relative body movement should be added to the Limits list. The limits in this list can have any order.
Motors that control body movement should be added to Motors. The motors in this list can have any order.
Ragdoll usage scenarios: