#include <Body.h>
Public Member Functions | |
Body (const World *pWorld) | |
Body (const Body &v) | |
Copies the body without the joints it has with other bodies. | |
~Body () | |
Joint * | getJoint (UINT index) |
const Joint * | getJoint (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 World * | getWorld () const |
virtual void | accept (Visitor &v) |
virtual void | traverse (Visitor &v) |
operator dBodyID () | |
operator const dBodyID () const | |
Disabling and auto-disabling | |
const Mass & | getMassData () const |
Mass & | getMassData () |
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 ¢er) |
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 World * | pWorld |
bool | allowCollideWithJointBodies |
Friends | |
class | Geom |
class | Joint |
It is different from geometry objects (it cannot perform collision detection). Note that "Torque" means here "Momentum".
Definition at line 178 of file Body.h.
Physics::Body::Body | ( | const World * | pWorld | ) |
Definition at line 56 of file Body.cpp.
References ASSERT, id, Physics::World::id, Physics::Mass::idBody, massData, setInfluencedByGravity(), and Physics::Mass::setSphere().
Physics::Body::Body | ( | const Body & | v | ) |
Copies the body without the joints it has with other bodies.
Definition at line 69 of file Body.cpp.
References Physics::dBodySetAngularVel(), Physics::dBodySetFiniteRotationAxis(), Physics::dBodySetForce(), Physics::dBodySetLinearVel(), Physics::dBodySetPosition(), Physics::dBodySetQuaternion(), Physics::dBodySetTorque(), id, Physics::World::id, Physics::Mass::idBody, isInfluencedByGravity(), massData, pWorld, and setInfluencedByGravity().
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] |
const Mass& Physics::Body::getMassData | ( | ) | const [inline] |
Definition at line 234 of file Body.h.
Referenced by Physics::createCanonicalBox(), Physics::createCanonicalCapsule(), Physics::createCanonicalCylinder(), Physics::createCanonicalSphere(), and Physics::NearCallback::operator()().
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] |
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] |
void Physics::Body::rotate | ( | const osg::Quat & | quat, | |
const osg::Vec3 & | center | |||
) | [inline] |
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").
void Physics::Body::setInfluencedByGravity | ( | bool | flag | ) | [inline] |
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] |
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().
bool Physics::Body::allowCollideWithJointBodies [protected] |
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 371 of file Body.h.
Referenced by Physics::Joint::attach(), Body(), isConnectedToExcludingContact(), and Physics::Geom::setBody().
Mass Physics::Body::massData [protected] |
const World* Physics::Body::pWorld [protected] |
dReal Physics::Body::windFactor [protected] |