Cyclone Cyclone: cyclone::RigidBody Class Reference

cyclone::RigidBody Class Reference

>RigidBody More...

#include <body.h>

Collaboration diagram for cyclone::RigidBody:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Integration and Simulation Functions
These functions are used to simulate the rigid body's motion over time. A normal application sets up one or more rigid bodies, applies permanent forces (i.e. gravity), then adds transient forces each frame, and integrates, prior to rendering.

Currently the only integration function provided is the first order Newton Euler method.

void calculateDerivedData ()
 Calculates internal data from state data.CalculateDerivedData.
void integrate (real duration)
 Integrates the rigid body forward in time by the given amount.
Accessor Functions for the Rigid Body's State
These functions provide access to the rigid body's characteristics or state. These data can be accessed individually, or en masse as an array of values (e.g. getCharacteristics, getState). When setting new data, make sure the calculateInternals function, or an integration routine, is called before trying to get data from the body, since the class contains a number of dependent values that will need recalculating.

void setMass (const real mass)
 Sets the mass of the rigid body.
real getMass () const
 Gets the mass of the rigid body.
void setInverseMass (const real inverseMass)
 Sets the inverse mass of the rigid body.
real getInverseMass () const
 Gets the inverse mass of the rigid body.
bool hasFiniteMass () const
 Returns true if the mass of the body is not-infinite.
void setInertiaTensor (const Matrix3 &inertiaTensor)
 Sets the intertia tensor for the rigid body.
void getInertiaTensor (Matrix3 *inertiaTensor) const
 Copies the current inertia tensor of the rigid body into the given matrix.
Matrix3 getInertiaTensor () const
 Gets a copy of the current inertia tensor of the rigid body.
void getInertiaTensorWorld (Matrix3 *inertiaTensor) const
 Copies the current inertia tensor of the rigid body into the given matrix.
Matrix3 getInertiaTensorWorld () const
 Gets a copy of the current inertia tensor of the rigid body.
void setInverseInertiaTensor (const Matrix3 &inverseInertiaTensor)
 Sets the inverse intertia tensor for the rigid body.
void getInverseInertiaTensor (Matrix3 *inverseInertiaTensor) const
 Copies the current inverse inertia tensor of the rigid body into the given matrix.
Matrix3 getInverseInertiaTensor () const
 Gets a copy of the current inverse inertia tensor of the rigid body.
void getInverseInertiaTensorWorld (Matrix3 *inverseInertiaTensor) const
 Copies the current inverse inertia tensor of the rigid body into the given matrix.
Matrix3 getInverseInertiaTensorWorld () const
 Gets a copy of the current inverse inertia tensor of the rigid body.
void setDamping (const real linearDamping, const real angularDamping)
 Sets both linear and angular damping in one function call.
void setLinearDamping (const real linearDamping)
 Sets the linear damping for the rigid body.
real getLinearDamping () const
 Gets the current linear damping value.
void setAngularDamping (const real angularDamping)
 Sets the angular damping for the rigid body.
real getAngularDamping () const
 Gets the current angular damping value.
void setPosition (const Vector3 &position)
 Sets the position of the rigid body.
void setPosition (const real x, const real y, const real z)
 Sets the position of the rigid body by component.
void getPosition (Vector3 *position) const
 Fills the given vector with the position of the rigid body.
Vector3 getPosition () const
 Gets the position of the rigid body.
void setOrientation (const Quaternion &orientation)
 Sets the orientation of the rigid body.
void setOrientation (const real r, const real i, const real j, const real k)
 Sets the orientation of the rigid body by component.
void getOrientation (Quaternion *orientation) const
 Fills the given quaternion with the current value of the rigid body's orientation.
Quaternion getOrientation () const
 Gets the orientation of the rigid body.
void getOrientation (Matrix3 *matrix) const
 Fills the given matrix with a transformation representing the rigid body's orientation.
void getOrientation (real matrix[9]) const
 Fills the given matrix data structure with a transformation representing the rigid body's orientation.
void getTransform (Matrix4 *transform) const
 Fills the given matrix with a transformation representing the rigid body's position and orientation.
void getTransform (real matrix[16]) const
 Fills the given matrix data structure with a transformation representing the rigid body's position and orientation.
void getGLTransform (float matrix[16]) const
 Fills the given matrix data structure with a transformation representing the rigid body's position and orientation.
Matrix4 getTransform () const
 Gets a transformation representing the rigid body's position and orientation.
Vector3 getPointInLocalSpace (const Vector3 &point) const
 Converts the given point from world space into the body's local space.
Vector3 getPointInWorldSpace (const Vector3 &point) const
 Converts the given point from world space into the body's local space.
Vector3 getDirectionInLocalSpace (const Vector3 &direction) const
 Converts the given direction from world space into the body's local space.
Vector3 getDirectionInWorldSpace (const Vector3 &direction) const
 Converts the given direction from world space into the body's local space.
void setVelocity (const Vector3 &velocity)
 Sets the velocity of the rigid body.
void setVelocity (const real x, const real y, const real z)
 Sets the velocity of the rigid body by component.
void getVelocity (Vector3 *velocity) const
 Fills the given vector with the velocity of the rigid body.
Vector3 getVelocity () const
 Gets the velocity of the rigid body.
void addVelocity (const Vector3 &deltaVelocity)
 Applies the given change in velocity.
void setRotation (const Vector3 &rotation)
 Sets the rotation of the rigid body.
void setRotation (const real x, const real y, const real z)
 Sets the rotation of the rigid body by component.
void getRotation (Vector3 *rotation) const
 Fills the given vector with the rotation of the rigid body.
Vector3 getRotation () const
 Gets the rotation of the rigid body.
void addRotation (const Vector3 &deltaRotation)
 Applies the given change in rotation.
bool getAwake () const
 Returns true if the body is awake and responding to integration.
void setAwake (const bool awake=true)
 Sets the awake state of the body.
bool getCanSleep () const
 Returns true if the body is allowed to go to sleep at any time.
void setCanSleep (const bool canSleep=true)
 Sets whether the body is ever allowed to go to sleep.
Retrieval Functions for Dynamic Quantities
These functions provide access to the acceleration properties of the body. The acceleration is generated by the simulation from the forces and torques applied to the rigid body. Acceleration cannot be directly influenced, it is set during integration, and represent the acceleration experienced by the body of the previous simulation step.

void getLastFrameAcceleration (Vector3 *linearAcceleration) const
 Fills the given vector with the current accumulated value for linear acceleration.
Vector3 getLastFrameAcceleration () const
 Gets the current accumulated value for linear acceleration.
Force, Torque and Acceleration Set-up Functions
These functions set up forces and torques to apply to the rigid body.

void clearAccumulators ()
 Clears the forces and torques in the accumulators.
void addForce (const Vector3 &force)
 Adds the given force to centre of mass of the rigid body.AddForceAtCenter.
void addForceAtPoint (const Vector3 &force, const Vector3 &point)
 Adds the given force to the given point on the rigid body.
void addForceAtBodyPoint (const Vector3 &force, const Vector3 &point)
 Adds the given force to the given point on the rigid body.
void addTorque (const Vector3 &torque)
 Adds the given torque to the rigid body.
void setAcceleration (const Vector3 &acceleration)
 Sets the constant acceleration of the rigid body.
void setAcceleration (const real x, const real y, const real z)
 Sets the constant acceleration of the rigid body by component.
void getAcceleration (Vector3 *acceleration) const
 Fills the given vector with the acceleration of the rigid body.
Vector3 getAcceleration () const
 Gets the acceleration of the rigid body.

Protected Attributes

Characteristic Data and State
This data holds the state of the rigid body. There are two sets of data: characteristics and state.

Characteristics are properties of the rigid body independent of its current kinematic situation. This includes mass, moment of inertia and damping properties. Two identical rigid bodys will have the same values for their characteristics.

State includes all the characteristics and also includes the kinematic situation of the rigid body in the current simulation. By setting the whole state data, a rigid body's exact game state can be replicated. Note that state does not include any forces applied to the body. Two identical rigid bodies in the same simulation will not share the same state values.

The state values make up the smallest set of independent data for the rigid body. Other state data is calculated from their current values. When state data is changed the dependent values need to be updated: this can be achieved either by integrating the simulation, or by calling the calculateInternals function. This two stage process is used because recalculating internals can be a costly process: all state changes should be carried out at the same time, allowing for a single call.

See also:
calculateInternals


real inverseMass
 Holds the inverse of the mass of the rigid body.RigidBodyIntro.
Matrix3 inverseInertiaTensor
 Holds the inverse of the body's inertia tensor.InverseInertiaTensor.
real linearDamping
 Holds the amount of damping applied to linear motion.
real angularDamping
 Holds the amount of damping applied to angular motion.AngularDamping.
Vector3 position
 Holds the linear position of the rigid body in world space.
Quaternion orientation
 Holds the angular orientation of the rigid body in world space.
Vector3 velocity
 Holds the linear velocity of the rigid body in world space.
Vector3 rotation
 Holds the angular velocity, or rotation, or the rigid body in world space.RigidBodyIntro.
Derived Data
These data members hold information that is derived from the other data in the class.

Matrix3 inverseInertiaTensorWorld
 Holds the inverse inertia tensor of the body in world space.
real motion
 Holds the amount of motion of the body.
bool isAwake
 A body can be put to sleep to avoid it being updated by the integration functions or affected by collisions with the world.
bool canSleep
 Some bodies may never be allowed to fall asleep.SleepData.
Matrix4 transformMatrix
 >RigidBodyIntro RigidBodyIntro
Force and Torque Accumulators
These data members store the current force, torque and acceleration of the rigid body. Forces can be added to the rigid body in any order, and the class decomposes them into their constituents, accumulating them for the next simulation step. At the simulation step, the accelerations are calculated and stored to be applied to the rigid body.

Vector3 forceAccum
 Holds the accumulated force to be applied at the next integration step.
Vector3 torqueAccum
 Holds the accumulated torque to be applied at the next integration step.
Vector3 acceleration
 Holds the acceleration of the rigid body.
Vector3 lastFrameAcceleration
 Holds the linear acceleration of the rigid body, for the previous frame.

Detailed Description

>RigidBody

/<RigidBodyIntro

It has position and orientation data, along with first derivatives. It can be integrated forward through time, and have forces, torques and impulses (linear or angular) applied to it. The rigid body manages its state and allows access through a set of methods.

A ridid body contains 64 words (the size of which is given by the precision: sizeof(real)). It contains no virtual functions, so should take up exactly 64 words in memory. Of this total 15 words are padding, distributed among the Vector3 data members. />RigidBodyIntro


Member Function Documentation

void cyclone::RigidBody::addForce const Vector3 force  ) 
 

Adds the given force to centre of mass of the rigid body.AddForceAtCenter.

The force is expressed in world-coordinates.

Parameters:
force The force to apply.

void cyclone::RigidBody::addForceAtBodyPoint const Vector3 force,
const Vector3 point
 

Adds the given force to the given point on the rigid body.

The direction of the force is given in world coordinates, but the application point is given in body space. This is useful for spring forces, or other forces fixed to the body.

Parameters:
force The force to apply.
point The location at which to apply the force, in body-coordinates.

void cyclone::RigidBody::addForceAtPoint const Vector3 force,
const Vector3 point
 

Adds the given force to the given point on the rigid body.

Both the force and the application point are given in world space. Because the force is not applied at the centre of mass, it may be split into both a force and torque.

Parameters:
force The force to apply.
point The location at which to apply the force, in world-coordinates.

void cyclone::RigidBody::addRotation const Vector3 deltaRotation  ) 
 

Applies the given change in rotation.

void cyclone::RigidBody::addTorque const Vector3 torque  ) 
 

Adds the given torque to the rigid body.

The force is expressed in world-coordinates.

Parameters:
torque The torque to apply.

void cyclone::RigidBody::addVelocity const Vector3 deltaVelocity  ) 
 

Applies the given change in velocity.

void cyclone::RigidBody::calculateDerivedData  ) 
 

Calculates internal data from state data.CalculateDerivedData.

This should be called after the body's state is altered directly (it is called automatically during integration). If you change the body's state and then intend to integrate before querying any data (such as the transform matrix), then you can ommit this step.

void cyclone::RigidBody::clearAccumulators  ) 
 

Clears the forces and torques in the accumulators.

This will be called automatically after each intergration step.

Vector3 cyclone::RigidBody::getAcceleration  )  const
 

Gets the acceleration of the rigid body.

Returns:
The acceleration of the rigid body. The acceleration is given in world local space.

void cyclone::RigidBody::getAcceleration Vector3 acceleration  )  const
 

Fills the given vector with the acceleration of the rigid body.

Parameters:
acceleration A pointer to a vector into which to write the acceleration. The acceleration is given in world local space.

real cyclone::RigidBody::getAngularDamping  )  const
 

Gets the current angular damping value.

Returns:
The current angular damping value.

bool cyclone::RigidBody::getAwake  )  const [inline]
 

Returns true if the body is awake and responding to integration.

Returns:
The awake state of the body.

bool cyclone::RigidBody::getCanSleep  )  const [inline]
 

Returns true if the body is allowed to go to sleep at any time.

Vector3 cyclone::RigidBody::getDirectionInLocalSpace const Vector3 direction  )  const
 

Converts the given direction from world space into the body's local space.

Note:
When a direction is converted between frames of reference, there is no translation required.
Parameters:
direction The direction to covert, given in world space.
Returns:
The converted direction, in local space.

Vector3 cyclone::RigidBody::getDirectionInWorldSpace const Vector3 direction  )  const
 

Converts the given direction from world space into the body's local space.

Note:
When a direction is converted between frames of reference, there is no translation required.
Parameters:
direction The direction to covert, given in local space.
Returns:
The converted direction, in world space.

void cyclone::RigidBody::getGLTransform float  matrix[16]  )  const
 

Fills the given matrix data structure with a transformation representing the rigid body's position and orientation.

The matrix is transposed from that returned by getTransform. This call returns a matrix suitable for applying as an OpenGL transform.

Note:
Transforming a vector by this matrix turns it from the body's local space to world space.
Parameters:
matrix A pointer to the matrix to fill.

Matrix3 cyclone::RigidBody::getInertiaTensor  )  const
 

Gets a copy of the current inertia tensor of the rigid body.

Returns:
A new matrix containing the current intertia tensor. The inertia tensor is expressed in the rigid body's local space.

void cyclone::RigidBody::getInertiaTensor Matrix3 inertiaTensor  )  const
 

Copies the current inertia tensor of the rigid body into the given matrix.

Parameters:
inertiaTensor A pointer to a matrix to hold the current inertia tensor of the rigid body. The inertia tensor is expressed in the rigid body's local space.

Matrix3 cyclone::RigidBody::getInertiaTensorWorld  )  const
 

Gets a copy of the current inertia tensor of the rigid body.

Returns:
A new matrix containing the current intertia tensor. The inertia tensor is expressed in world space.

void cyclone::RigidBody::getInertiaTensorWorld Matrix3 inertiaTensor  )  const
 

Copies the current inertia tensor of the rigid body into the given matrix.

Parameters:
inertiaTensor A pointer to a matrix to hold the current inertia tensor of the rigid body. The inertia tensor is expressed in world space.

Matrix3 cyclone::RigidBody::getInverseInertiaTensor  )  const
 

Gets a copy of the current inverse inertia tensor of the rigid body.

Returns:
A new matrix containing the current inverse intertia tensor. The inertia tensor is expressed in the rigid body's local space.

void cyclone::RigidBody::getInverseInertiaTensor Matrix3 inverseInertiaTensor  )  const
 

Copies the current inverse inertia tensor of the rigid body into the given matrix.

Parameters:
inverseInertiaTensor A pointer to a matrix to hold the current inverse inertia tensor of the rigid body. The inertia tensor is expressed in the rigid body's local space.

Matrix3 cyclone::RigidBody::getInverseInertiaTensorWorld  )  const
 

Gets a copy of the current inverse inertia tensor of the rigid body.

Returns:
A new matrix containing the current inverse intertia tensor. The inertia tensor is expressed in world space.

void cyclone::RigidBody::getInverseInertiaTensorWorld Matrix3 inverseInertiaTensor  )  const
 

Copies the current inverse inertia tensor of the rigid body into the given matrix.

Parameters:
inverseInertiaTensor A pointer to a matrix to hold the current inverse inertia tensor of the rigid body. The inertia tensor is expressed in world space.

real cyclone::RigidBody::getInverseMass  )  const
 

Gets the inverse mass of the rigid body.

Returns:
The current inverse mass of the rigid body.

Vector3 cyclone::RigidBody::getLastFrameAcceleration  )  const
 

Gets the current accumulated value for linear acceleration.

The acceleration accumulators are set during the integration step. They can be read to determine the rigid body's acceleration over the last integration step. The linear acceleration is given in world space.

Returns:
The rigid body's linear acceleration.

void cyclone::RigidBody::getLastFrameAcceleration Vector3 linearAcceleration  )  const
 

Fills the given vector with the current accumulated value for linear acceleration.

The acceleration accumulators are set during the integration step. They can be read to determine the rigid body's acceleration over the last integration step. The linear acceleration is given in world space.

Parameters:
linearAcceleration A pointer to a vector to receive the linear acceleration data.

real cyclone::RigidBody::getLinearDamping  )  const
 

Gets the current linear damping value.

Returns:
The current linear damping value.

real cyclone::RigidBody::getMass  )  const
 

Gets the mass of the rigid body.

Returns:
The current mass of the rigid body.

void cyclone::RigidBody::getOrientation real  matrix[9]  )  const
 

Fills the given matrix data structure with a transformation representing the rigid body's orientation.

Note:
Transforming a direction vector by this matrix turns it from the body's local space to world space.
Parameters:
matrix A pointer to the matrix to fill.

void cyclone::RigidBody::getOrientation Matrix3 matrix  )  const
 

Fills the given matrix with a transformation representing the rigid body's orientation.

Note:
Transforming a direction vector by this matrix turns it from the body's local space to world space.
Parameters:
matrix A pointer to the matrix to fill.

Quaternion cyclone::RigidBody::getOrientation  )  const
 

Gets the orientation of the rigid body.

Returns:
The orientation of the rigid body.

void cyclone::RigidBody::getOrientation Quaternion orientation  )  const
 

Fills the given quaternion with the current value of the rigid body's orientation.

Parameters:
orientation A pointer to a quaternion to receive the orientation data.

Vector3 cyclone::RigidBody::getPointInLocalSpace const Vector3 point  )  const
 

Converts the given point from world space into the body's local space.

Parameters:
point The point to covert, given in world space.
Returns:
The converted point, in local space.

Vector3 cyclone::RigidBody::getPointInWorldSpace const Vector3 point  )  const
 

Converts the given point from world space into the body's local space.

Parameters:
point The point to covert, given in local space.
Returns:
The converted point, in world space.

Vector3 cyclone::RigidBody::getPosition  )  const
 

Gets the position of the rigid body.

Returns:
The position of the rigid body.

void cyclone::RigidBody::getPosition Vector3 position  )  const
 

Fills the given vector with the position of the rigid body.

Parameters:
position A pointer to a vector into which to write the position.

Vector3 cyclone::RigidBody::getRotation  )  const
 

Gets the rotation of the rigid body.

Returns:
The rotation of the rigid body. The rotation is given in world local space.

void cyclone::RigidBody::getRotation Vector3 rotation  )  const
 

Fills the given vector with the rotation of the rigid body.

Parameters:
rotation A pointer to a vector into which to write the rotation. The rotation is given in world local space.

Matrix4 cyclone::RigidBody::getTransform  )  const
 

Gets a transformation representing the rigid body's position and orientation.

Note:
Transforming a vector by this matrix turns it from the body's local space to world space.
Returns:
The transform matrix for the rigid body.

void cyclone::RigidBody::getTransform real  matrix[16]  )  const
 

Fills the given matrix data structure with a transformation representing the rigid body's position and orientation.

Note:
Transforming a vector by this matrix turns it from the body's local space to world space.
Parameters:
matrix A pointer to the matrix to fill.

void cyclone::RigidBody::getTransform Matrix4 transform  )  const
 

Fills the given matrix with a transformation representing the rigid body's position and orientation.

Note:
Transforming a vector by this matrix turns it from the body's local space to world space.
Parameters:
transform A pointer to the matrix to fill.

Vector3 cyclone::RigidBody::getVelocity  )  const
 

Gets the velocity of the rigid body.

Returns:
The velocity of the rigid body. The velocity is given in world local space.

void cyclone::RigidBody::getVelocity Vector3 velocity  )  const
 

Fills the given vector with the velocity of the rigid body.

Parameters:
velocity A pointer to a vector into which to write the velocity. The velocity is given in world local space.

bool cyclone::RigidBody::hasFiniteMass  )  const
 

Returns true if the mass of the body is not-infinite.

void cyclone::RigidBody::integrate real  duration  ) 
 

Integrates the rigid body forward in time by the given amount.

This function uses a Newton-Euler integration method, which is a linear approximation to the correct integral. For this reason it may be inaccurate in some cases.

void cyclone::RigidBody::setAcceleration const real  x,
const real  y,
const real  z
 

Sets the constant acceleration of the rigid body by component.

Parameters:
x The x coordinate of the new acceleration of the rigid body.
y The y coordinate of the new acceleration of the rigid body.
z The z coordinate of the new acceleration of the rigid body.

void cyclone::RigidBody::setAcceleration const Vector3 acceleration  ) 
 

Sets the constant acceleration of the rigid body.

Parameters:
acceleration The new acceleration of the rigid body.

void cyclone::RigidBody::setAngularDamping const real  angularDamping  ) 
 

Sets the angular damping for the rigid body.

Parameters:
angularDamping The speed that rotation is shed from the rigid body.
See also:
setLinearDamping

void cyclone::RigidBody::setAwake const bool  awake = true  ) 
 

Sets the awake state of the body.

If the body is set to be not awake, then its velocities are also cancelled, since a moving body that is not awake can cause problems in the simulation.

Parameters:
awake The new awake state of the body.

void cyclone::RigidBody::setCanSleep const bool  canSleep = true  ) 
 

Sets whether the body is ever allowed to go to sleep.

Bodies under the player's control, or for which the set of transient forces applied each frame are not predictable, should be kept awake.

Parameters:
canSleep Whether the body can now be put to sleep.

void cyclone::RigidBody::setDamping const real  linearDamping,
const real  angularDamping
 

Sets both linear and angular damping in one function call.

Parameters:
linearDamping The speed that velocity is shed from the rigid body.
angularDamping The speed that rotation is shed from the rigid body.
See also:
setLinearDamping

setAngularDamping

void cyclone::RigidBody::setInertiaTensor const Matrix3 inertiaTensor  ) 
 

Sets the intertia tensor for the rigid body.

Parameters:
inertiaTensor The inertia tensor for the rigid body. This must be a full rank matrix and must be invertible.
Warning:
This invalidates internal data for the rigid body. Either an integration function, or the calculateInternals function should be called before trying to get any settings from the rigid body.

void cyclone::RigidBody::setInverseInertiaTensor const Matrix3 inverseInertiaTensor  ) 
 

Sets the inverse intertia tensor for the rigid body.

Parameters:
inverseInertiaTensor The inverse inertia tensor for the rigid body. This must be a full rank matrix and must be invertible.
Warning:
This invalidates internal data for the rigid body. Either an integration function, or the calculateInternals function should be called before trying to get any settings from the rigid body.

void cyclone::RigidBody::setInverseMass const real  inverseMass  ) 
 

Sets the inverse mass of the rigid body.

Parameters:
inverseMass The new inverse mass of the body. This may be zero, for a body with infinite mass (i.e. unmovable).
Warning:
This invalidates internal data for the rigid body. Either an integration function, or the calculateInternals function should be called before trying to get any settings from the rigid body.

void cyclone::RigidBody::setLinearDamping const real  linearDamping  ) 
 

Sets the linear damping for the rigid body.

Parameters:
linearDamping The speed that velocity is shed from the rigid body.
See also:
setAngularDamping

void cyclone::RigidBody::setMass const real  mass  ) 
 

Sets the mass of the rigid body.

Parameters:
mass The new mass of the body. This may not be zero. Small masses can produce unstable rigid bodies under simulation.
Warning:
This invalidates internal data for the rigid body. Either an integration function, or the calculateInternals function should be called before trying to get any settings from the rigid body.

void cyclone::RigidBody::setOrientation const real  r,
const real  i,
const real  j,
const real  k
 

Sets the orientation of the rigid body by component.

Parameters:
r The real component of the rigid body's orientation quaternion.
i The first complex component of the rigid body's orientation quaternion.
j The second complex component of the rigid body's orientation quaternion.
k The third complex component of the rigid body's orientation quaternion.
Note:
The given orientation does not need to be normalised, and can be zero. This function automatically constructs a valid rotation quaternion with (0,0,0,0) mapping to (1,0,0,0).

void cyclone::RigidBody::setOrientation const Quaternion orientation  ) 
 

Sets the orientation of the rigid body.

Parameters:
orientation The new orientation of the rigid body.
Note:
The given orientation does not need to be normalised, and can be zero. This function automatically constructs a valid rotation quaternion with (0,0,0,0) mapping to (1,0,0,0).

void cyclone::RigidBody::setPosition const real  x,
const real  y,
const real  z
 

Sets the position of the rigid body by component.

Parameters:
x The x coordinate of the new position of the rigid body.
y The y coordinate of the new position of the rigid body.
z The z coordinate of the new position of the rigid body.

void cyclone::RigidBody::setPosition const Vector3 position  ) 
 

Sets the position of the rigid body.

Parameters:
position The new position of the rigid body.

void cyclone::RigidBody::setRotation const real  x,
const real  y,
const real  z
 

Sets the rotation of the rigid body by component.

The rotation is given in world space.

Parameters:
x The x coordinate of the new rotation of the rigid body.
y The y coordinate of the new rotation of the rigid body.
z The z coordinate of the new rotation of the rigid body.

void cyclone::RigidBody::setRotation const Vector3 rotation  ) 
 

Sets the rotation of the rigid body.

Parameters:
rotation The new rotation of the rigid body. The rotation is given in world space.

void cyclone::RigidBody::setVelocity const real  x,
const real  y,
const real  z
 

Sets the velocity of the rigid body by component.

The velocity is given in world space.

Parameters:
x The x coordinate of the new velocity of the rigid body.
y The y coordinate of the new velocity of the rigid body.
z The z coordinate of the new velocity of the rigid body.

void cyclone::RigidBody::setVelocity const Vector3 velocity  ) 
 

Sets the velocity of the rigid body.

Parameters:
velocity The new velocity of the rigid body. The velocity is given in world space.


Member Data Documentation

Vector3 cyclone::RigidBody::acceleration [protected]
 

Holds the acceleration of the rigid body.

This value can be used to set acceleration due to gravity (its primary use), or any other constant acceleration.

real cyclone::RigidBody::angularDamping [protected]
 

Holds the amount of damping applied to angular motion.AngularDamping.

Damping is required to remove energy added through numerical instability in the integrator.

bool cyclone::RigidBody::canSleep [protected]
 

Some bodies may never be allowed to fall asleep.SleepData.

User controlled bodies, for example, should be always awake.

Vector3 cyclone::RigidBody::forceAccum [protected]
 

Holds the accumulated force to be applied at the next integration step.

Matrix3 cyclone::RigidBody::inverseInertiaTensor [protected]
 

Holds the inverse of the body's inertia tensor.InverseInertiaTensor.

The intertia tensor provided must not be degenerate (that would mean the body had zero inertia for spinning along one axis). As long as the tensor is finite, it will be invertible. The inverse tensor is used for similar reasons to the use of inverse mass.

The inertia tensor, unlike the other variables that define a rigid body, is given in body space.

See also:
inverseMass

Matrix3 cyclone::RigidBody::inverseInertiaTensorWorld [protected]
 

Holds the inverse inertia tensor of the body in world space.

The inverse inertia tensor member is specified in the body's local space.

See also:
inverseInertiaTensor

real cyclone::RigidBody::inverseMass [protected]
 

Holds the inverse of the mass of the rigid body.RigidBodyIntro.

It is more useful to hold the inverse mass because integration is simpler, and because in real time simulation it is more useful to have bodies with infinite mass (immovable) than zero mass (completely unstable in numerical simulation).

bool cyclone::RigidBody::isAwake [protected]
 

A body can be put to sleep to avoid it being updated by the integration functions or affected by collisions with the world.

Vector3 cyclone::RigidBody::lastFrameAcceleration [protected]
 

Holds the linear acceleration of the rigid body, for the previous frame.

real cyclone::RigidBody::linearDamping [protected]
 

Holds the amount of damping applied to linear motion.

Damping is required to remove energy added through numerical instability in the integrator.

real cyclone::RigidBody::motion [protected]
 

Holds the amount of motion of the body.

This is a recency weighted mean that can be used to put a body to sleap.

Quaternion cyclone::RigidBody::orientation [protected]
 

Holds the angular orientation of the rigid body in world space.

Vector3 cyclone::RigidBody::position [protected]
 

Holds the linear position of the rigid body in world space.

Vector3 cyclone::RigidBody::rotation [protected]
 

Holds the angular velocity, or rotation, or the rigid body in world space.RigidBodyIntro.

Vector3 cyclone::RigidBody::torqueAccum [protected]
 

Holds the accumulated torque to be applied at the next integration step.

Matrix4 cyclone::RigidBody::transformMatrix [protected]
 

>RigidBodyIntro RigidBodyIntro

This can be achieved by calling the getPointIn*Space functions. /<RigidBodyIntro

See also:
getPointInLocalSpace

getPointInWorldSpace

getTransform

Vector3 cyclone::RigidBody::velocity [protected]
 

Holds the linear velocity of the rigid body in world space.


The documentation for this class was generated from the following file: