#include <Physics_Body.h>
Inherits DigitalSpaces::DIObjectBase.
A physics body is an organizational object. It can be thought of to contain collision shapes, and to be linked to other bodies by joints. It contains (or represents) the center of mass of an object, and is the part that is considered to move when a physics object moves (shapes are relative to the body).
Properties supported from DIPhysicsBase:
Public Member Functions | |
| void | WorldPointToLocal (out_Vector3f *point) |
| Convert a world coordinate position to a position relative to this object. | |
| void | LocalPointToWorld (out_Vector3f *point) |
| Convert a position relative to this object to a world coordinate position. | |
| void | ApplyForce (in_Vector3f *vecForce, in_Vector3f *vecPosition) |
| Apply a force to the object, using world co-ordinates for the force vector and the point to apply it to. | |
| void | ApplyRelativeForce (in_Vector3f *vecForce, in_Vector3f *vecPosition) |
| Apply a force to the object, using local co-ordinates for the force vector and point to apply it to. | |
| void | ApplyTorque (in_Vector3f *vecTorque) |
| Apply a rotational force, with the axis specified in the world coordinate system. | |
| void | ApplyRelativeTorque (in_Vector3f *vecTorque) |
| Apply a rotational force, with the axis as relative to the objects orientation. | |
| void | GetTotalForce (out_Vector3f *force) |
| Get the total force being applied to the object. | |
| void | GetTotalTorque (out_Vector3f *torque) |
| Get the total torque being applied to the object. | |
| float | GetMass () |
| Used to retreive the mass property of this object. | |
| void | GetAttachedShapeNames (DIStringList1 *names) |
| Returns the names of all the DIPhysicsShapes which are attached to this body. | |
| void | GetAttachedJointNames (DIStringList1 *names) |
| Returns the names of all the DIPhysicsJoints which are attached to this body. | |
Set Property functions | |
| void | SetAbsolutePosition (in_Vector3f *vecPosition) |
| Set the absolute position of the physics body. | |
| void | SetLinearVelocity (in_Vector3f *vecVelocity) |
| Set the linear velocity (change in position per second) in world coordinates. | |
| void | SetAngularVelocity (in_Vector3f *vecVelocity) |
| Set the angular velocity (rotation around the euler axis), in world coordinates. | |
| void | SetRelativeLinearVelocity (in_Vector3f *vecVelocity) |
| Set the linear velocity (change in position per second) in local coordinates. | |
| void | SetRelativeAngularVelocity (in_Vector3f *vecVelocity) |
| Set the angular velocity (rotation around the euler axis), in local coordinates. | |
| void | SetAbsoluteOrientation (in_Quaternionf *quatRot) |
| Set the orientation of the physics body, in world coordinates. | |
| void | SetLinearDamping (float fDamp) |
| Sets the linear damping factor. | |
| void | SetAngularDamping (float fDamp) |
| Sets the angular damping factor. | |
| void | SetMaximumAngularVelocity (float fMaxVel) |
| Sets the maximum angular velocity. | |
Get Property functions | |
| void | GetAbsolutePosition (out_Vector3f *) |
| Retreives the position of the physics body, in world coordinates. | |
| void | GetLinearVelocity (out_Vector3f *) |
| Retreives the velocity of the physics body, in world coordinates. | |
| void | GetAngularVelocity (out_Vector3f *angVelocity) |
| Retreives the angular velocity (change of orientation). | |
| void | GetRelativeAngularVelocity (out_Vector3f *angVelocity) |
| Retreives the angular velocity (change of orientation), in local coordinates. | |
| void | GetRelativeLinearVelocity (out_Vector3f *) |
| Retreives the velocity of the physics body, in local coordinates. | |
| void | GetAbsoluteOrientation (out_Quaternionf *) |
| Retreives the physics bodies absolute orientation, in world coordinates. | |
| float | GetLinearDamping () |
| Retreives the linear damping of the object. | |
| float | GetAngularDamping () |
| Retreives the angular damping of the object. | |
| float | GetMaximumAngularVelocity () |
| Retreives the maximum angular velocity of the object. | |
| void DigitalSpaces::DIPhysicsBody::SetAbsolutePosition | ( | in_Vector3f * | vecPosition | ) |
Set the absolute position of the physics body.
| vecPosition | New position of the physics body, in world coordinates. |
| void DigitalSpaces::DIPhysicsBody::SetLinearVelocity | ( | in_Vector3f * | vecVelocity | ) |
Set the linear velocity (change in position per second) in world coordinates.
| void DigitalSpaces::DIPhysicsBody::SetAngularVelocity | ( | in_Vector3f * | vecVelocity | ) |
Set the angular velocity (rotation around the euler axis), in world coordinates.
| vecVelocity | Rotation, measured in radians per second, around each of the world axis. |
| void DigitalSpaces::DIPhysicsBody::SetRelativeLinearVelocity | ( | in_Vector3f * | vecVelocity | ) |
Set the linear velocity (change in position per second) in local coordinates.
| void DigitalSpaces::DIPhysicsBody::SetRelativeAngularVelocity | ( | in_Vector3f * | vecVelocity | ) |
Set the angular velocity (rotation around the euler axis), in local coordinates.
| vecVelocity | Rotation, measured in radians per second, around each of the local axis. |
| void DigitalSpaces::DIPhysicsBody::SetAbsoluteOrientation | ( | in_Quaternionf * | quatRot | ) |
Set the orientation of the physics body, in world coordinates.
| quatRot | The new orientation of the physics body, in world coordinates. |
| void DigitalSpaces::DIPhysicsBody::SetLinearDamping | ( | float | fDamp | ) |
Sets the linear damping factor.
Linear damping is a multiplier applied to the objects current velocity (change in position) each simulation heartbeat. A multiplier of 0.2 causes the linear velocity to be decreased by a factor of 0.2 each simulation heartbeat.
This is useful to simulate generic resistance forces applied by the medium the object is moving through.
The default value is 0.0
| void DigitalSpaces::DIPhysicsBody::SetAngularDamping | ( | float | fDamp | ) |
Sets the angular damping factor.
angular damping is a multiplier applied to the objects current angular velocity (change in orientation) each simulation heartbeat. A multiplier of 0.2 causes the angular velocity to be decreased by a factor of 0.2 each simulation heartbeat.
This is useful to simulate generic resistance forces applied by the medium the object is moving through.
The default value is 0.0
| void DigitalSpaces::DIPhysicsBody::SetMaximumAngularVelocity | ( | float | fMaxVel | ) |
Sets the maximum angular velocity.
This sets a maximum speed of rotation for this object. The current rotation "speed" is calculated as the square root of the sum of the squared speed around each axis. If the calculated speed is greater then specified by this function, the angular velocity is scaled by the difference, and re-applied.
If set to 0 or a negative value, then no limiting is done. 0 is the default value.
| void DigitalSpaces::DIPhysicsBody::GetAbsolutePosition | ( | out_Vector3f * | ) |
Retreives the position of the physics body, in world coordinates.
| void DigitalSpaces::DIPhysicsBody::GetLinearVelocity | ( | out_Vector3f * | ) |
Retreives the velocity of the physics body, in world coordinates.
| void DigitalSpaces::DIPhysicsBody::GetAngularVelocity | ( | out_Vector3f * | angVelocity | ) |
Retreives the angular velocity (change of orientation).
| [out] | angVelocity | Change in rotation around each of the world coordinate euler axis, measured in radians per second. |
| void DigitalSpaces::DIPhysicsBody::GetRelativeAngularVelocity | ( | out_Vector3f * | angVelocity | ) |
Retreives the angular velocity (change of orientation), in local coordinates.
| [out] | angVelocity | Change in rotation around each of the local coordinate euler axis, measured in radians per second. |
| void DigitalSpaces::DIPhysicsBody::GetRelativeLinearVelocity | ( | out_Vector3f * | ) |
Retreives the velocity of the physics body, in local coordinates.
| void DigitalSpaces::DIPhysicsBody::GetAbsoluteOrientation | ( | out_Quaternionf * | ) |
Retreives the physics bodies absolute orientation, in world coordinates.
| float DigitalSpaces::DIPhysicsBody::GetLinearDamping | ( | ) |
Retreives the linear damping of the object.
See SetLinearDamping for an explanation on linear damping.
| float DigitalSpaces::DIPhysicsBody::GetAngularDamping | ( | ) |
Retreives the angular damping of the object.
See SetAngularDamping for an explanation on angular damping.
| float DigitalSpaces::DIPhysicsBody::GetMaximumAngularVelocity | ( | ) |
Retreives the maximum angular velocity of the object.
See SetMaximumAngularVelocity for an explanation on angular velocity.
| void DigitalSpaces::DIPhysicsBody::WorldPointToLocal | ( | out_Vector3f * | point | ) |
Convert a world coordinate position to a position relative to this object.
| [in,out] | point | Contains the world coordinate position, is set to the local coordinate position. |
| void DigitalSpaces::DIPhysicsBody::LocalPointToWorld | ( | out_Vector3f * | point | ) |
Convert a position relative to this object to a world coordinate position.
| [in,out] | point | Contains the local coordinate position, is set to the world coordinate position. |
| void DigitalSpaces::DIPhysicsBody::ApplyForce | ( | in_Vector3f * | vecForce, | |
| in_Vector3f * | vecPosition | |||
| ) |
Apply a force to the object, using world co-ordinates for the force vector and the point to apply it to.
Applying a vector off center will impart some spin to the object.
| void DigitalSpaces::DIPhysicsBody::ApplyRelativeForce | ( | in_Vector3f * | vecForce, | |
| in_Vector3f * | vecPosition | |||
| ) |
Apply a force to the object, using local co-ordinates for the force vector and point to apply it to.
Applying a vector off center will impart some spin to the object.
I'm not sure if the implementation of this function (as of 4th Sept 2007) is correct.
| void DigitalSpaces::DIPhysicsBody::ApplyTorque | ( | in_Vector3f * | vecTorque | ) |
Apply a rotational force, with the axis specified in the world coordinate system.
| vecTorque | The rotational force to be applied, around each of the Euler axis (x, y, z). |
| void DigitalSpaces::DIPhysicsBody::ApplyRelativeTorque | ( | in_Vector3f * | vecTorque | ) |
Apply a rotational force, with the axis as relative to the objects orientation.
| vecTorque | The rotational force to be applied, around each of the Euler axis (x, y, z). |
| void DigitalSpaces::DIPhysicsBody::GetTotalForce | ( | out_Vector3f * | force | ) |
Get the total force being applied to the object.
This is only the force as the sum of calls to ApplyForce and ApplyLocalForce, as applied within the last Heartbeat. It does not include force induced by joints or contacts.
| void DigitalSpaces::DIPhysicsBody::GetTotalTorque | ( | out_Vector3f * | torque | ) |
Get the total torque being applied to the object.
This is only the torque as the sum of calls to ApplyTorque and ApplyRelativeTorque, as applied within the last Heartbeat. It does not include torque induced by joints or contacts.
| float DigitalSpaces::DIPhysicsBody::GetMass | ( | ) |
| void DigitalSpaces::DIPhysicsBody::GetAttachedShapeNames | ( | DIStringList1 * | names | ) |
Returns the names of all the DIPhysicsShapes which are attached to this body.
These names can be used to find the shapes, via DIPhysicsWorld::FindShape
| names | A String List that will have the names of the attached shapes appended to it. The implementation does not clear the list before appending the names. |
| void DigitalSpaces::DIPhysicsBody::GetAttachedJointNames | ( | DIStringList1 * | names | ) |
Returns the names of all the DIPhysicsJoints which are attached to this body.
These names can be used to find the shapes, via DIPhysicsWorld::FindJoint
| names | A String List that will have the names of the attached joints appended to it. The implementation does not clear the list before appending the names. |
1.5.6