RigidBody Class |
Namespace: DigitalRune.Physics
The RigidBody type exposes the following members.
Name | Description | |
---|---|---|
RigidBody |
Initializes a new instance of the RigidBody class.
| |
RigidBody(Shape) |
Initializes a new instance of the RigidBody class.
| |
RigidBody(Shape, MassFrame, IMaterial) |
Initializes a new instance of the RigidBody class.
|
Name | Description | |
---|---|---|
AddForce(Vector3F) |
Applies a force at the center of mass of the rigid body.
| |
AddForce(Vector3F, Vector3F) |
Applies a force to the rigid body.
| |
AddTorque |
Applies a torque at the center of mass of the rigid body.
| |
ApplyAngularImpulse |
Applies an angular impulse at the center of mass
| |
ApplyImpulse |
Applies an impulse at a given position.
| |
ApplyLinearImpulse |
Applies a linear impulse at the center of mass
| |
ClearForces |
Clears all forces that were set with AddForce(Vector3F, Vector3F),
AddForce(Vector3F) or AddTorque(Vector3F).
| |
Clone |
Creates a new RigidBody that is a clone (deep copy) of the current instance.
| |
CloneCore |
Makes the instance a clone (deep copy) of the specified RigidBody.
| |
CreateInstanceCore |
When implemented in a derived class, creates a new instance of the
RigidBody derived class.
| |
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.) | |
GetVelocityOfLocalPoint |
Gets the velocity of a point on the rigid body.
| |
GetVelocityOfWorldPoint |
Gets the velocity of a point on the rigid body.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnAddToSimulation |
Called when this rigid body is added to a simulation.
| |
OnPoseChanged |
Raises the PoseChanged event.
| |
OnRemoveFromSimulation |
Called when this rigid body is removed from a simulation.
| |
OnShapeChanged |
Raises the ShapeChanged event.
| |
Sleep |
Deactivates this rigid body.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
WakeUp |
Wakes the rigid body up from sleeping.
|
Name | Description | |
---|---|---|
ComputeKMatrix |
Computes the K matrix needed by sequential impulse-based methods.
(Defined by ConstraintHelper.) | |
SetVelocityOfWorldPoint |
Applies an impulse so that the velocity of point on the body is changed.
(Defined by ConstraintHelper.) |
Name | Description | |
---|---|---|
Aabb |
Gets the axis-aligned bounding box (AABB).
| |
AngularVelocity |
Gets or sets the angular velocity about the center of mass in world space.
| |
AutoUpdateMass | ||
CanSleep |
Gets or sets a value indicating whether this body can sleep.
| |
CcdEnabled |
Gets or sets a value indicating whether Continuous Collision Detection (CCD) is enabled.
| |
CollisionObject |
Gets the collision object.
| |
CollisionResponseEnabled |
Gets or sets a value indicating whether collision response is enabled.
| |
InertiaInverseWorld |
Gets the effective inverse inertia.
| |
IsSleeping |
Gets a value indicating whether this rigid body is sleeping.
| |
KineticEnergy |
Gets the kinetic energy.
| |
LinearVelocity |
Gets or sets the linear velocity of this body in world space.
| |
LockRotationX |
Gets or sets a value indicating whether the body can rotate around its local mass frame
x-axis.
| |
LockRotationY |
Gets or sets a value indicating whether the body can rotate around its local mass frame
y-axis.
| |
LockRotationZ |
Gets or sets a value indicating whether the body can rotate around its local mass frame
z-axis.
| |
MassFrame |
Gets or sets the mass frame which defines the mass properties of this body.
| |
MassInverse |
Gets the effective inverse mass.
| |
Material |
Gets or sets the material.
| |
MotionType |
Gets or sets the motion type.
| |
Name |
Gets the name.
| |
Pose |
Gets or sets the pose (position and orientation).
| |
PoseCenterOfMass |
Gets or sets the pose (position and orientation) of the center of mass.
| |
RotationalEnergy |
Gets the rotational kinetic energy.
| |
Scale |
Gets or sets the scale.
| |
Shape |
Gets or sets the shape.
| |
Simulation |
Gets the simulation.
| |
TranslationalEnergy |
Gets the translational kinetic energy.
| |
UserData |
Gets or sets the user data.
|
Name | Description | |
---|---|---|
PoseChanged |
Occurs when the pose was changed.
| |
ShapeChanged |
Name | Description | |
---|---|---|
IGeometricObjectClone |
Creates a new IGeometricObject that is a clone (deep copy) of the current
instance.
|
A rigid body is a body that is simulated by rigid body dynamics. The body has a Shape that is constant for the simulation (although the shape can be exchanged by the user). No deformations are computed, therefore this body cannot model a soft body like cloth or fluids.
The body also has a mass properties defined in MassFrame and a Material that defines friction, bounciness and other material properties.
Center Of Mass: The body has a Pose that defines its position and orientation in world space. The origin of the local space of the body can be different from its center of mass. The body has a PoseCenterOfMass that defines the pose of the center of mass in world space. The center of mass is automatically computed from the shape of the rigid body when the body's MassFrame is created. To move the rigid body to a new pose the properties Pose or PoseCenterOfMass can be used; the two properties are synchronized automatically.
Collision Detection: The rigid body class implements IGeometricObject and it automatically creates a CollisionObject for the rigid body. This collision object is automatically added to the CollisionDomain of the simulation.
Important: An IGeometricObject instance registers event handlers for the Changed event of the contained Shape. Therefore, a Shape will have an indirect reference to the IGeometricObject. This is no problem if the geometric object exclusively owns the shape. However, this could lead to problems ("life extension bugs" a.k.a. "memory leaks") when multiple geometric objects share the same shape: One geometric object is no longer used but it cannot be collected by the garbage collector because the shape still holds a reference to the object.
Therefore, when Shapes are shared between multiple IGeometricObjects: Always set the property Shape to Empty when the IGeometricObject is no longer used. Empty is a special immutable shape that never raises any Changed events. Setting Shape to Empty ensures that the internal event handlers are unregistered and the object can be garbage-collected properly.
Cloning: The rigid body can be cloned using the Clone method. Cloning creates a deep copy of the object. The UserData and the Material are copied and not cloned, so the clone will refer to the same UserData and Material instances. All other properties are properly cloned.
Sleeping: See also SleepingSettings. The rigid body automatically wakes up if important properties are changed - for example, if the Shape is changed, the body wakes up.