Physics::Body Class Reference

Wrapper representnig physical bodies (roughly a mass with coordinates and velocity). More...

#include <Body.h>

List of all members.

Public Member Functions

 Body (const World *pWorld)
 Body (const Body &v)
 Copies the body without the joints it has with other bodies.
 ~Body ()
JointgetJoint (UINT index)
const JointgetJoint (UINT index) const
void setInfluencedByGravity (bool flag)
bool isInfluencedByGravity () const
bool isConnectedToExcludingContact (Body *pBody) const
void setAllowCollideWithJointBodies (bool flag)
 Set if geoms attached to this body collide with geoms attached to connected (=joint) bodies ; default is false because it is faster to compute and because it is much better to set joint stops when possible.
bool getAllowCollideWithJointBodies () const
const WorldgetWorld () const
virtual void accept (Visitor &v)
virtual void traverse (Visitor &v)
 operator dBodyID ()
 operator const dBodyID () const
Disabling and auto-disabling
const MassgetMassData () const
MassgetMassData ()
Position and orientation
If one or more geoms are attached to the body, setting these parameters will also set those of the geom, and vice-versa.

void translate (const osg::Vec3 &vec)
void rotate (const osg::Quat &quat)
void rotate (const osg::Quat &quat, const osg::Vec3 &center)
 Rotates the body around a given point.
void setMatrix (const osg::Matrix &matrix)
 Convinience method for setting position and rotation at once.
osg::Matrix getMatrix () const
 Convinience method for getting position and rotation at once.
Forces
dReal getWindFactor () const
 Gets a purely gameplay parameter that should affect wind forces applications (=1 by default).
void setWindFactor (dReal factor)
 Sets a purely gameplay parameter that should affect wind forces applications (=1 by default).

Public Attributes

std::vector< osg::Vec3 > contactPos
 "Close contact check" storage (keeps track of all contact positions).

Protected Attributes

dBodyID id
Mass massData
dReal windFactor
const WorldpWorld
bool allowCollideWithJointBodies

Friends

class Geom
class Joint


Detailed Description

Wrapper representnig physical bodies (roughly a mass with coordinates and velocity).

It is different from geometry objects (it cannot perform collision detection). Note that "Torque" means here "Momentum".

Author:
Sukender
Version:
0.2.0 - Enhanced for gameplay, have a flag to (dis)allow collision with joint bodies.

Definition at line 178 of file Body.h.


Constructor & Destructor Documentation

Physics::Body::Body ( const World pWorld  ) 

Physics::Body::Body ( const Body v  ) 

Physics::Body::~Body (  )  [inline]

Definition at line 183 of file Body.h.


Member Function Documentation

void Physics::Body::accept ( Visitor v  )  [virtual]

Definition at line 135 of file Body.cpp.

References Physics::Visitor::apply().

Referenced by C3DPhy::accept().

bool Physics::Body::getAllowCollideWithJointBodies (  )  const [inline]

Definition at line 355 of file Body.h.

const Joint * Physics::Body::getJoint ( UINT  index  )  const

Definition at line 124 of file Body.cpp.

Joint * Physics::Body::getJoint ( UINT  index  ) 

Definition at line 119 of file Body.cpp.

Referenced by traverse().

Mass& Physics::Body::getMassData (  )  [inline]

Definition at line 235 of file Body.h.

const Mass& Physics::Body::getMassData (  )  const [inline]

osg::Matrix Physics::Body::getMatrix (  )  const [inline]

Convinience method for getting position and rotation at once.

Definition at line 262 of file Body.h.

References Physics::toGraphMatRotationPosition().

dReal Physics::Body::getWindFactor (  )  const [inline]

Gets a purely gameplay parameter that should affect wind forces applications (=1 by default).

Definition at line 312 of file Body.h.

const World* Physics::Body::getWorld (  )  const [inline]

Definition at line 357 of file Body.h.

bool Physics::Body::isConnectedToExcludingContact ( Body pBody  )  const

Definition at line 133 of file Body.cpp.

References Physics::Joint::CONTACT, and id.

Referenced by Physics::NearCallback::operator()().

bool Physics::Body::isInfluencedByGravity (  )  const [inline]

Definition at line 342 of file Body.h.

Referenced by Body().

Physics::Body::operator const dBodyID (  )  const [inline]

Definition at line 366 of file Body.h.

Physics::Body::operator dBodyID (  )  [inline]

Definition at line 365 of file Body.h.

void Physics::Body::rotate ( const osg::Quat &  quat,
const osg::Vec3 &  center 
) [inline]

Rotates the body around a given point.

Definition at line 252 of file Body.h.

void Physics::Body::rotate ( const osg::Quat &  quat  )  [inline]

Definition at line 250 of file Body.h.

References Physics::dBodyGetQuaternionV(), and Physics::dBodySetQuaternion().

Referenced by C3DPhy::rotate().

void Physics::Body::setAllowCollideWithJointBodies ( bool  flag  )  [inline]

Set if geoms attached to this body collide with geoms attached to connected (=joint) bodies ; default is false because it is faster to compute and because it is much better to set joint stops when possible.

Usually, bodies' geoms do not collide with other bodies' geoms that share a joint with them in order to speed up collision and to make things more stable. If two bodies have different flags, then collision is allowed. Be aware that if collision is allowed, then it will take more CPU (of course), and may potentially make your simulation unstable (Errors may cause collisions, collisions may cause corrections that will "fight" against joints). Dev note : The test is done during collision detection (the "near callback").

See also:
Physics::Joint::setLoStop(), Physics::Joint::setHiStop() and other methods in Physics::Joint for joint stops.

Definition at line 354 of file Body.h.

void Physics::Body::setInfluencedByGravity ( bool  flag  )  [inline]

Definition at line 341 of file Body.h.

Referenced by Body().

void Physics::Body::setMatrix ( const osg::Matrix &  matrix  )  [inline]

Convinience method for setting position and rotation at once.

Definition at line 257 of file Body.h.

References Physics::dBodySetPosition(), and Physics::dBodySetRotation().

void Physics::Body::setWindFactor ( dReal  factor  )  [inline]

Sets a purely gameplay parameter that should affect wind forces applications (=1 by default).

Definition at line 314 of file Body.h.

void Physics::Body::translate ( const osg::Vec3 &  vec  )  [inline]

Definition at line 244 of file Body.h.

References Physics::dBodySetPosition().

Referenced by C3DPhy::translate().

void Physics::Body::traverse ( Visitor v  )  [virtual]

Definition at line 136 of file Body.cpp.

References Physics::Visitor::apply(), and getJoint().

Referenced by Physics::Visitor::traverse().


Friends And Related Function Documentation

friend class Geom [friend]

Definition at line 369 of file Body.h.

friend class Joint [friend]

Definition at line 370 of file Body.h.


Member Data Documentation

Definition at line 376 of file Body.h.

std::vector<osg::Vec3> Physics::Body::contactPos

"Close contact check" storage (keeps track of all contact positions).

Definition at line 360 of file Body.h.

Referenced by C3DPhy::clearBodyContactPos(), and Physics::NearCallback::operator()().

dBodyID Physics::Body::id [mutable, protected]

Definition at line 372 of file Body.h.

Referenced by Body().

const World* Physics::Body::pWorld [protected]

Definition at line 375 of file Body.h.

Referenced by Body().

dReal Physics::Body::windFactor [protected]

Definition at line 373 of file Body.h.


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

Generated on Sun Jan 17 11:39:35 2010 for PVLE (Pro-Vocation Light Engine) by  doxygen 1.5.9