dtCore::Physical Class Reference

A rigid body object which can behave with realistic physical properties. More...

#include <physical.h>

Inheritance diagram for dtCore::Physical:

dtCore::Transformable dtCore::DeltaDrawable dtCore::Base dtCore::Object dtGame::GameActor dtTerrain::Terrain dtActors::MeshTerrainActor dtActors::AnimationGameActor dtActors::Cal3DGameActor dtActors::CoordinateConfigActor dtActors::GameMeshActor dtActors::TaskActor dtGame::IEnvGameActor dtActors::TaskActorGameEvent dtActors::TaskActorOrdered dtActors::TaskActorRollup dtActors::BasicEnvironmentActor dtActors::EnvActor

List of all members.

Public Member Functions

 Physical (const std::string &name="Physical")
 Physical (TransformableNode &node, const std::string &name="Physical")
 Overloaded constructor will use the supplied node instead of creating one internally.
void SetBodyID (dBodyID bodyID)
 Sets the ODE body identifier associated with this object.
dBodyID GetBodyID () const
 Returns the ODE body identifier associated with this object.
void EnableDynamics (bool enable=true)
 Enables or disables dynamics for this object.
bool DynamicsEnabled () const
 Checks whether or not dynamics are enabled for this object.
void SetMass (const dMass *mass)
 Sets the ODE mass parameters of this object.
void GetMass (dMass *mass) const
 Retrieves the ODE mass parameters of this object.
void SetMass (float mass)
 Sets the mass of this object.
float GetMass () const
 Returns the mass of this object.
void SetCenterOfGravity (const osg::Vec3 &centerOfGravity)
 Sets this object's center of gravity.
void GetCenterOfGravity (osg::Vec3 &dest) const
 Retrieves this object's center of gravity.
void SetInertiaTensor (const osg::Matrix &inertiaTensor)
 Sets this object's inertia tensor.
void GetInertiaTensor (osg::Matrix &mat) const
 Retrieves this object's inertia tensor.
virtual void PostPhysicsStepUpdate ()
 Updates the state of this object just after a physical simulation step.
virtual bool FilterContact (dContact *contact, Transformable *collider)
 Modifies or cancels the specified contact joint definition according to the relationship between this object and the specified collider.

Protected Member Functions

virtual ~Physical ()


Detailed Description

A rigid body object which can behave with realistic physical properties.

Typical use would involve supplying the shape to use for the collision detection and the mass of the body. A Physical instance is not enabled by default and must be enabled by calling EnableDynamics().

Since a Physical is derived from DeltaDrawable, it already has a geometry node associated with it. As such, a collision geometry can be assigned to this body by either supplying the shape properties, or by passing a NULL into the SetCollision*() methods.


Constructor & Destructor Documentation

Physical::Physical ( const std::string &  name = "Physical"  ) 

Physical::Physical ( TransformableNode node,
const std::string &  name = "Physical" 
)

Overloaded constructor will use the supplied node instead of creating one internally.

Parameters:
node : A node this class should use internally
name : The name of this instance

Physical::~Physical (  )  [protected, virtual]


Member Function Documentation

void Physical::SetBodyID ( dBodyID  bodyID  ) 

Sets the ODE body identifier associated with this object.

Should only be called by dtCore::Scene. If you call this outside the content of Scene be warning that any transformations you have on bodyID will be removed.

Parameters:
bodyID the new body identifier
Should only be called by Scene.

Parameters:
bodyID the new body identifier

dBodyID Physical::GetBodyID (  )  const

Returns the ODE body identifier associated with this object.

Returns:
the object's body identifier

void Physical::EnableDynamics ( bool  enable = true  ) 

Enables or disables dynamics for this object.

Parameters:
enable true to enable dynamics, false to disable

bool Physical::DynamicsEnabled (  )  const

Checks whether or not dynamics are enabled for this object.

Returns:
true if dynamics are enabled, false otherwise

void Physical::SetMass ( const dMass *  mass  ) 

Sets the ODE mass parameters of this object.

Parameters:
mass a pointer to the mass structure to copy

void Physical::GetMass ( dMass *  mass  )  const

Retrieves the ODE mass parameters of this object.

Parameters:
mass a pointer to the mass structure to fill

void Physical::SetMass ( float  mass  ) 

Sets the mass of this object.

Parameters:
mass the new mass, in kilograms

float Physical::GetMass (  )  const

Returns the mass of this object.

Returns:
the current mass

void Physical::SetCenterOfGravity ( const osg::Vec3 &  centerOfGravity  ) 

Sets this object's center of gravity.

Parameters:
centerOfGravity the new center of gravity

void Physical::GetCenterOfGravity ( osg::Vec3 &  dest  )  const

Retrieves this object's center of gravity.

Parameters:
dest the vector in which to place the center of gravity

void Physical::SetInertiaTensor ( const osg::Matrix &  inertiaTensor  ) 

Sets this object's inertia tensor.

Parameters:
inertiaTensor the new inertia tensor, uses only the rotation part of the transform matrix
inertiaTensor the new inertia tensor, only uses the rotation part of the transform matrix

void Physical::GetInertiaTensor ( osg::Matrix &  dest  )  const

Retrieves this object's inertia tensor.

Parameters:
dest the matrix in which to place the inertia tensor, uses only rotation part of the transform matrix

void Physical::PostPhysicsStepUpdate (  )  [virtual]

Updates the state of this object just after a physical simulation step.

Should only be called by dtCore::Scene. The default implementation copies the new object position into the user-accessible transformation.

Reimplemented from dtCore::Transformable.

virtual bool dtCore::Physical::FilterContact ( dContact *  contact,
Transformable collider 
) [inline, virtual]

Modifies or cancels the specified contact joint definition according to the relationship between this object and the specified collider.

Should only be called by dtCore::Scene.

Parameters:
contact the joint definition to modify
collider the object with which this is colliding
Returns:
true to keep the contact joint as modified, false to cancel it

Reimplemented from dtCore::Transformable.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008