Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

oxygen::Body Class Reference

Body encapsulates an ODE rigid body object. More...

#include <body.h>

Inheritance diagram for oxygen::Body:

Inheritance graph
[legend]
Collaboration diagram for oxygen::Body:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Body ()
virtual ~Body ()
dBodyID GetODEBody () const
 returns the ID of the mangaged ODE body
void Enable ()
 enables this body.
void Disable ()
 disables this body
bool IsEnabled () const
 returns true if this body is enabled
void UseGravity (bool f)
 sets whether the body is influenced by the world's gravity or not.
bool UsesGravity () const
 returns true, if this body is influenced by the world's gravity
void SetMass (float mass)
 sets the mass of this body
void SetMassParameters (const dMass &mass)
 set the ODE mass parameters of this body
float GetMass () const
 returns the mass of this body
void GetMassParameters (dMass &mass) const
 returns the ODE mass parameters of this body
void SetSphere (float density, float radius)
 sets the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.
void SetSphereTotal (float total_mass, float radius)
 sets the mass parameters to represent a sphere of the given radius and total mass, with the center of mass at (0,0,0) relative to the body.
void SetBox (float density, const salt::Vector3f &size)
 Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body.
void SetBoxTotal (float total_mass, const salt::Vector3f &size)
 Set the mass parameters to represent a box of the given dimensions and total mass, with the center of mass at (0,0,0) relative to the body.
void SetCylinder (float density, float radius, float length)
 Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.
void SetCylinderTotal (float total_mass, float radius, float length)
 Set the mass parameters to represent a flat-ended cylinder of the given parameters and total mass, with the center of mass at (0,0,0) relative to the body.
void SetCappedCylinder (float density, float radius, float length)
void SetCappedCylinderTotal (float total_mass, float radius, float length)
salt::Vector3f GetVelocity () const
 returns the current linear velocity vector of this body
void SetVelocity (const salt::Vector3f &vel)
 sets the current linear velocity of this body
void SetRotation (const salt::Matrix &rot)
 sets the roation of this body
salt::Vector3f GetAngularVelocity () const
 returns the current angular velocity of this body
void SetAngularVelocity (const salt::Vector3f &vel)
 sets the current angular velocity of this body
void AddForce (const salt::Vector3f &force)
 applies a force to the managed ODE body
void AddTorque (const salt::Vector3f &torque)
 aplies a force to the managed ODE body
void SetPosition (const salt::Vector3f &pos)
 sets the position of the managed ODE body
salt::Vector3f GetPosition () const
 returns the current poosition of this body

Static Public Member Functions

static boost::shared_ptr<
Body
GetBody (dBodyID id)
 returns the Body node corresponding to the given ODE body

Protected Member Functions

virtual void OnLink ()
 creates the managed ODE body and moves it to the position of it's scene-graph parent
bool CreateBody ()
 create the managed ODE body; returns true on success

Protected Attributes

dBodyID mODEBody
 the managed ode body

Private Member Functions

virtual void PostPhysicsUpdateInternal ()
 updates the the internal state after physics calculation, i.e.

Detailed Description

Body encapsulates an ODE rigid body object.

A rigid body has various properties from the point of view of the simulation. Some properties change over time: position, linear velocity, orientation and angular velocity. Other body properties are usually constant over time: Mass, Center of mass and Inertia matrix (mass distribution matrix)

Definition at line 38 of file body.h.


Constructor & Destructor Documentation

Body::Body  ) 
 

Definition at line 31 of file body.cpp.

Body::~Body  )  [virtual]
 

Definition at line 35 of file body.cpp.

References mODEBody.


Member Function Documentation

void Body::AddForce const salt::Vector3f force  ) 
 

applies a force to the managed ODE body

Definition at line 323 of file body.cpp.

References mODEBody, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Here is the call graph for this function:

void Body::AddTorque const salt::Vector3f torque  ) 
 

aplies a force to the managed ODE body

Definition at line 329 of file body.cpp.

References mODEBody, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Here is the call graph for this function:

bool Body::CreateBody  )  [protected]
 

create the managed ODE body; returns true on success

Definition at line 83 of file body.cpp.

References zeitgeist::Object::GetLog(), oxygen::ODEObject::GetWorldID(), and mODEBody.

Referenced by OnLink().

Here is the call graph for this function:

void Body::Disable  ) 
 

disables this body

Definition at line 54 of file body.cpp.

References mODEBody.

void Body::Enable  ) 
 

enables this body.

Each body can be enabled or disabled. Disabled bodies are effectively turned off and are not updated during a simulation step. Disabling bodies is an effective way to save computation time when it is known that the bodies are motionless or otherwise irrelevent to the simulation.

Definition at line 49 of file body.cpp.

References mODEBody.

Vector3f Body::GetAngularVelocity  )  const
 

returns the current angular velocity of this body

Definition at line 248 of file body.cpp.

References mODEBody.

shared_ptr< Body > Body::GetBody dBodyID  id  )  [static]
 

returns the Body node corresponding to the given ODE body

Definition at line 291 of file body.cpp.

References zeitgeist::Object::GetSelf().

Referenced by oxygen::Joint::GetBody().

Here is the call graph for this function:

float Body::GetMass  )  const
 

returns the mass of this body

Definition at line 138 of file body.cpp.

References mODEBody.

void Body::GetMassParameters dMass &  mass  )  const
 

returns the ODE mass parameters of this body

Definition at line 145 of file body.cpp.

References mODEBody.

dBodyID Body::GetODEBody  )  const
 

returns the ID of the mangaged ODE body

Definition at line 44 of file body.cpp.

References mODEBody.

Vector3f Body::GetPosition  )  const
 

returns the current poosition of this body

Definition at line 342 of file body.cpp.

References mODEBody.

Vector3f Body::GetVelocity  )  const
 

returns the current linear velocity vector of this body

Definition at line 228 of file body.cpp.

References mODEBody.

bool Body::IsEnabled  )  const
 

returns true if this body is enabled

Definition at line 59 of file body.cpp.

References mODEBody.

void Body::OnLink  )  [protected, virtual]
 

creates the managed ODE body and moves it to the position of it's scene-graph parent

Reimplemented from zeitgeist::Leaf.

Definition at line 108 of file body.cpp.

References CreateBody(), zeitgeist::Leaf::GetParent(), mODEBody, zeitgeist::Leaf::OnLink(), salt::Matrix::Pos(), SetPosition(), and SetRotation().

Here is the call graph for this function:

void Body::PostPhysicsUpdateInternal  )  [private, virtual]
 

updates the the internal state after physics calculation, i.e.

synchronises this scene graph node and the corresponding ODE body.

Reimplemented from oxygen::BaseNode.

Definition at line 260 of file body.cpp.

References zeitgeist::Leaf::GetParent(), salt::Matrix::m, and mODEBody.

Here is the call graph for this function:

void Body::SetAngularVelocity const salt::Vector3f vel  ) 
 

sets the current angular velocity of this body

Definition at line 255 of file body.cpp.

References mODEBody.

void Body::SetBox float  density,
const salt::Vector3f size
 

Set the mass parameters to represent a box of the given dimensions and density, with the center of mass at (0,0,0) relative to the body.

Definition at line 169 of file body.cpp.

References mODEBody.

void Body::SetBoxTotal float  total_mass,
const salt::Vector3f size
 

Set the mass parameters to represent a box of the given dimensions and total mass, with the center of mass at (0,0,0) relative to the body.

Definition at line 176 of file body.cpp.

References mODEBody.

void Body::SetCappedCylinder float  density,
float  radius,
float  length
 

Definition at line 205 of file body.cpp.

References mODEBody.

void Body::SetCappedCylinderTotal float  total_mass,
float  radius,
float  length
 

Definition at line 216 of file body.cpp.

References mODEBody.

void Body::SetCylinder float  density,
float  radius,
float  length
 

Set the mass parameters to represent a flat-ended cylinder of the given parameters and density, with the center of mass at (0,0,0) relative to the body.

The radius of the cylinder is radius. The length of the cylinder is length. The cylinder's long axis is oriented along the body's z axis.

Definition at line 183 of file body.cpp.

References mODEBody.

void Body::SetCylinderTotal float  total_mass,
float  radius,
float  length
 

Set the mass parameters to represent a flat-ended cylinder of the given parameters and total mass, with the center of mass at (0,0,0) relative to the body.

The radius of the cylinder is radius. The length of the cylinder is length. The cylinder's long axis is oriented along the body's z axis.

Definition at line 194 of file body.cpp.

References mODEBody.

void Body::SetMass float  mass  ) 
 

sets the mass of this body

Definition at line 129 of file body.cpp.

References mODEBody.

void Body::SetMassParameters const dMass &  mass  ) 
 

set the ODE mass parameters of this body

Definition at line 150 of file body.cpp.

References mODEBody.

void Body::SetPosition const salt::Vector3f pos  ) 
 

sets the position of the managed ODE body

Definition at line 335 of file body.cpp.

References mODEBody, salt::TVector3< DATATYPE, TYPE >::x(), salt::TVector3< DATATYPE, TYPE >::y(), and salt::TVector3< DATATYPE, TYPE >::z().

Referenced by OnLink().

Here is the call graph for this function:

void Body::SetRotation const salt::Matrix rot  ) 
 

sets the roation of this body

Definition at line 240 of file body.cpp.

References oxygen::ODEObject::ConvertRotationMatrix(), and mODEBody.

Referenced by OnLink().

Here is the call graph for this function:

void Body::SetSphere float  density,
float  radius
 

sets the mass parameters to represent a sphere of the given radius and density, with the center of mass at (0,0,0) relative to the body.

Definition at line 155 of file body.cpp.

References mODEBody.

void Body::SetSphereTotal float  total_mass,
float  radius
 

sets the mass parameters to represent a sphere of the given radius and total mass, with the center of mass at (0,0,0) relative to the body.

Definition at line 162 of file body.cpp.

References mODEBody.

void Body::SetVelocity const salt::Vector3f vel  ) 
 

sets the current linear velocity of this body

Definition at line 234 of file body.cpp.

References mODEBody.

void Body::UseGravity bool  f  ) 
 

sets whether the body is influenced by the world's gravity or not.

Bodies are constructed to be influenced by the world's gravity by default.

Definition at line 64 of file body.cpp.

References mODEBody.

bool Body::UsesGravity  )  const
 

returns true, if this body is influenced by the world's gravity

Definition at line 78 of file body.cpp.

References mODEBody.


Member Data Documentation

dBodyID oxygen::Body::mODEBody [protected]
 

the managed ode body

Definition at line 196 of file body.h.

Referenced by AddForce(), AddTorque(), CreateBody(), Disable(), Enable(), GetAngularVelocity(), GetMass(), GetMassParameters(), GetODEBody(), GetPosition(), GetVelocity(), IsEnabled(), OnLink(), PostPhysicsUpdateInternal(), SetAngularVelocity(), SetBox(), SetBoxTotal(), SetCappedCylinder(), SetCappedCylinderTotal(), SetCylinder(), SetCylinderTotal(), SetMass(), SetMassParameters(), SetPosition(), SetRotation(), SetSphere(), SetSphereTotal(), SetVelocity(), UseGravity(), UsesGravity(), and ~Body().


The documentation for this class was generated from the following files:
Generated on Thu Apr 6 15:45:07 2006 for rcssserver3d by  doxygen 1.4.4