SO3Engine
|
main class for all Rigid Bodies in the system. More...
#include <OgreNewt_Body.h>
Public Types | |
typedef std::function< void(OgreNewt::Body *, Ogre::Real timeStep, int threadIndex)> | ForceCallback |
custom force callback. | |
typedef std::function< void(OgreNewt::Body *)> | TriggerEnterCallback |
typedef std::function< void(OgreNewt::Body *)> | TriggerInsideCallback |
typedef std::function< void(OgreNewt::Body *)> | TriggerExitCallback |
typedef std::function< void(OgreNewt::Body *)> | NodeUpdateNotifyCallback |
node update notify. | |
typedef std::function< bool(dLong, OgreNewt::Body *, const Ogre::Quaternion &, const Ogre::Vector3 &, Ogre::Plane &)> | buoyancyPlaneCallback |
custom transform callback. | |
Public Types inherited from OgreNewt::_DestructorCallback< Body > | |
typedef std::function< void(Body *)> | DestructorCallbackFunction |
destructor callback | |
Public Member Functions | |
Body (World *const W, const OgreNewt::CollisionPtr &col, int bodytype=0, bool trigger=false) | |
constructor. | |
~Body () | |
destructor | |
void | setUserData (const Ogre::Any &data) |
set user data to connect this class to another. | |
void | setUserData (void *data) |
const Ogre::Any & | getUserData () const |
retrieve pointer to previously set user data. | |
void * | getUserData () const |
NewtonBody * | getNewtonBody () const |
get a pointer to the NewtonBody object | |
Ogre::Node * | getOgreNode () const |
get a pointer to the attached Node. | |
OgreNewt::World *const | getWorld () const |
get a pointer to the OgreNewt::World this body belongs to. | |
void | setType (int type) |
set the type for this body. | |
int | getType () const |
get the type set for this body. | |
void | attachNode (Ogre::Node *node) |
attach this body to an Ogre::Node* | |
void | enableSimulation (bool state) |
void | setStandardForceCallback () |
set a standard gravity callback for this body to use. | |
void | setCustomForceAndTorqueCallback (ForceCallback callback) |
set a custom force callback for this body to use. | |
template<class c > | |
void | setCustomForceAndTorqueCallback (std::function< void(c *, Body *, float, int)> callback, c *instancedClassPointer) |
void | setTriggerEnterCallback (TriggerEnterCallback callback) |
template<class c > | |
void | setTriggerEnterCallback (std::function< void(c *, Body *)> callback, c *instancedClassPointer) |
void | setTriggerInsideCallback (TriggerInsideCallback callback) |
template<class c > | |
void | setTriggerInsideCallback (std::function< void(c *, Body *)> callback, c *instancedClassPointer) |
void | setTriggerExitCallback (TriggerExitCallback callback) |
template<class c > | |
void | setTriggerExitCallback (std::function< void(c *, Body *)> callback, c *instancedClassPointer) |
void | removeForceAndTorqueCallback () |
remove any force callbacks. | |
ForceCallback | getForceTorqueCallback () |
returns correct force-torque callback | |
void | setNodeUpdateNotify (NodeUpdateNotifyCallback callback) |
set a custom node update notify. | |
template<class c > | |
void | setNodeUpdateNotify (std::function< void(c *, OgreNewt::Body *)> callback, c *instancedClassPointer) |
void | removeNodeUpdateNotify () |
remove any transform callbacks. | |
void | setNodeUpdateJointNotify (NodeUpdateNotifyCallback callback) |
template<class c > | |
void | setNodeUpdateJointNotify (std::function< void(c *, OgreNewt::Body *)> callback, c *instancedClassPointer) |
void | removeNodeUpdateJointNotify () |
remove any transform callbacks. | |
void | setPositionOrientation (const Ogre::Vector3 &pos, const Ogre::Quaternion &orient, int threadIndex=-1) |
position and orient the body arbitrarily. | |
void | setPositionOrientationFromNode (int threadIndex=-1) |
position and orient the body from node. | |
void | updatePositionOrientation (const Ogre::Vector3 &pos, const Ogre::Quaternion &orient, int threadIndex=-1) |
void | setVisualPosition (Ogre::Vector3 pos, Ogre::Quaternion quat) |
void | setMassMatrix (Ogre::Real mass, const Ogre::Vector3 &inertia) |
set the mass and inertia for the body. | |
void | setMass (Ogre::Real mass) |
void | setCenterOfMass (const Ogre::Vector3 ¢erOfMass) |
set the body's center of mass | |
Ogre::Vector3 | getCenterOfMass () const |
get the center of mass. | |
Ogre::Vector3 | calculateOffset () const |
Ogre::Vector3 | calculateInertialMatrix () const |
void | freeze () |
freeze the rigid body. | |
void | unFreeze () |
unfreeze the rigid body. | |
bool | isFreezed () |
is the body freezed? | |
void | setMaterialGroupID (const MaterialID *ID) |
set the material for the body | |
void | setContinuousCollisionMode (unsigned state) |
prevents fast moving bodies from "tunneling" through other bodies. | |
void | setJointRecursiveCollision (unsigned state) |
set whether all parent/children pairs connected to this body should be allowed to collide. | |
void | setOmega (const Ogre::Vector3 &omega) |
set an arbitrary omega for the body. | |
void | setVelocity (const Ogre::Vector3 &vel) |
set an arbitrary velocity for the body. | |
void | setLinearDamping (Ogre::Real damp) |
set the linear damping for the body. | |
void | setAngularDamping (const Ogre::Vector3 &damp) |
set the angular damping for the body. | |
void | setCollision (const OgreNewt::CollisionPtr &col) |
set the collision that represents the shape of the body | |
void | setAutoSleep (int flag) |
set whether the body should "sleep" when equilibruim is reached. | |
int | getAutoSleep () |
get whether the body should "sleep" when equilibrium is reached. | |
bool | isSleeping () |
void | setSleep () |
void | wakeUp () |
const OgreNewt::CollisionPtr & | getCollision () const |
set the factors that cause a body to "freeze" when equilibrium reached. | |
void | setScale (const Ogre::Vector3 &scale, const Ogre::Quaternion &orient, Ogre::Vector3 &pos) |
set the collision scale | |
const OgreNewt::MaterialID * | getMaterialGroupID () const |
get a pointer to the Material assigned to this body. | |
int | getContinuousCollisionMode () const |
returns current setting for this body. | |
int | getJointRecursiveCollision () const |
returns current setting for this body. | |
void | getPositionOrientation (Ogre::Vector3 &pos, Ogre::Quaternion &orient) const |
get position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation) | |
Ogre::Vector3 | getPosition () const |
returns body position | |
Ogre::Quaternion | getOrientation () const |
returns body orientation | |
void | getVisualPositionOrientation (Ogre::Vector3 &pos, Ogre::Quaternion &orient) const |
get the node position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation) | |
Ogre::Vector3 | getVisualPosition () const |
return body visual position | |
Ogre::Quaternion | getVisualOrientation () const |
returns body visual orientation | |
Ogre::AxisAlignedBox | getAABB () const |
get the axis-aligned bounding box for this body. | |
void | getMassMatrix (Ogre::Real &mass, Ogre::Vector3 &inertia) const |
get Ogre::Real(mass) and Ogre::Vector3(inertia) of the body. | |
Ogre::Real | getMass () const |
return body mass | |
Ogre::Vector3 | getInertia () const |
return body inertia | |
void | getInvMass (Ogre::Real &mass, Ogre::Vector3 &inertia) const |
get invert mass + inertia for the body. | |
Ogre::Vector3 | getOmega () const |
get omega of the body. in global space. | |
Ogre::Vector3 | getVelocity () const |
get velocity of the body. in global coordinates. | |
Ogre::Vector3 | getForce () const |
get the force acting on the body. | |
Ogre::Vector3 | getTorque () const |
get the torque acting on the body. | |
Ogre::Vector3 | getForceAcceleration () const |
get the linear acceleration due to forces acting on the body. | |
Ogre::Vector3 | getTorqueAcceleration () const |
get the rotational acceleration due to torque acting on the body. | |
Ogre::Real | getLinearDamping () const |
get linear damping | |
Ogre::Vector3 | getAngularDamping () const |
get angular damping | |
Ogre::Vector3 | calculateInverseDynamicsForce (Ogre::Real timestep, Ogre::Vector3 desiredVelocity) |
calculate force needed for given velocity | |
void | addImpulse (const Ogre::Vector3 &deltav, const Ogre::Vector3 &posit) |
get the freeze threshold | |
void | addForce (const Ogre::Vector3 &force) |
add force to the body. | |
void | addTorque (const Ogre::Vector3 &torque) |
add torque to the body. | |
void | setForce (const Ogre::Vector3 &force) |
set the force for a body. | |
void | setTorque (const Ogre::Vector3 &torque) |
set the torque for a body. | |
Body * | getNext () const |
use this function to iterate through all bodies | |
void | addGlobalForce (const Ogre::Vector3 &force, const Ogre::Vector3 &pos) |
helper function that adds a force (and resulting torque) to an object in global cordinates. | |
void | addGlobalForceAccumulate (const Ogre::Vector3 &force, const Ogre::Vector3 &pos) |
helper function that adds a force (and resulting torque) to an object in global cordinates called from anywhere. | |
void | addLocalForce (const Ogre::Vector3 &force, const Ogre::Vector3 &pos) |
CollisionPrimitiveType | getCollisionPrimitiveType () const |
Returns the Collisiontype for the Collision from this Body. | |
NewtonCollision * | getNewtonCollision () const |
Returns the Newton Collision for this Body. | |
void | requestNodeUpdate (int threadIndex, bool forceNodeUpdate=false) |
Call this to signify that the position/orientation of the attached node needs to be updated. | |
bool | isNodeUpdateNeeded () const |
Return if an node update was requested. | |
void | updateNode (Ogre::Real interpolatParam) |
update the position of the node (if attached) and sets m_nodeupdateneeded to false | |
void | MoveToPosition (const Ogre::Vector3 &destPos, const Ogre::Real &stiffness, Ogre::Real timestep) |
void | RotateToOrientation (const Ogre::Quaternion &destquat, const Ogre::Real &stiffness, Ogre::Real timestep) |
Public Member Functions inherited from OgreNewt::_DestructorCallback< Body > | |
_DestructorCallback () | |
constructor | |
virtual | ~_DestructorCallback () |
destructor | |
void | removeDestructorCallback () |
remove any destructor callback | |
void | setDestructorCallback (DestructorCallbackFunction fun) |
set the destructor callback | |
void | setDestructorCallback (std::function< void(c *, Body *)> callback, c *instancedClassPointer) |
Protected Attributes | |
NewtonBody * | m_body |
OgreNewt::CollisionPtr | m_collision |
const MaterialID * | m_matid |
World *const | m_world |
std::vector< std::pair< Ogre::Vector3, Ogre::Vector3 > > | m_accumulatedGlobalForces |
Ogre::Vector3 | m_nodePosit |
Ogre::Vector3 | m_curPosit |
Ogre::Vector3 | m_prevPosit |
Ogre::Vector3 | m_scale |
Ogre::Quaternion | m_nodeRotation |
Ogre::Quaternion | m_curRotation |
Ogre::Quaternion | m_prevRotation |
Ogre::Any | m_userdata |
void * | m_userdata |
int | m_type |
Ogre::Node * | m_node |
ForceCallback | m_forcecallback |
TriggerEnterCallback | m_triggerEnterCallback |
TriggerInsideCallback | m_triggerInsideCallback |
TriggerExitCallback | m_triggerExitCallback |
NodeUpdateNotifyCallback | m_nodeupdatenotifycallback |
NodeUpdateNotifyCallback | m_nodeupdatejointnotifycallback |
main class for all Rigid Bodies in the system.
Definition at line 38 of file OgreNewt_Body.h.
typedef std::function<bool(dLong, OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, Ogre::Plane&)> OgreNewt::Body::buoyancyPlaneCallback |
custom transform callback.
This function is called from within the OgreNewt::World::update() command for all Rigid Bodies, after all collision and forces have been resolved. this command is intended to allow the user to align a visual object with the new position and orientation of the rigid body. OgreNewt has a general transform callback built-in for use with Ogre. however you can create your own for special cases. you are passed a quaternion (orientation) and vector (position) of the rigid body in world space. buoyancy plane callback
this function is a user-defined function that supplies Newton with the plane equation for the surface of the liquid when applying buoyancy forces. the user should create their own function for this, that returns an Ogre::Plane based on their own criteria. you get a pointer to the OgreNewt::Body, and it's current orientation and location to boot. note that this callback will be called for each collision primitive in the body (if it is a compound collision). if you want to ignore buoyancy for this collision primitive, just return false from the function. otherwise, fill the "retPlane" with your liquid surface plane, and return true to apply buoyancy to the primitive.
Definition at line 91 of file OgreNewt_Body.h.
typedef std::function<void(OgreNewt::Body*, Ogre::Real timeStep, int threadIndex)> OgreNewt::Body::ForceCallback |
custom force callback.
this function is called from within the OgreNewt::World::update() command when applying forces to Rigid Bodies, such as gravity, etc.
You can set this as the custom force callback for a body by using the setCustomForceCallback() function. Using std::function means OgreNewt can now accept pointers to member functions of specific classes.
Definition at line 49 of file OgreNewt_Body.h.
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::NodeUpdateNotifyCallback |
node update notify.
Definition at line 65 of file OgreNewt_Body.h.
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerEnterCallback |
Definition at line 51 of file OgreNewt_Body.h.
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerExitCallback |
Definition at line 53 of file OgreNewt_Body.h.
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerInsideCallback |
Definition at line 52 of file OgreNewt_Body.h.
OgreNewt::Body::Body | ( | World *const | W, |
const OgreNewt::CollisionPtr & | col, | ||
int | bodytype = 0 , |
||
bool | trigger = false |
||
) |
constructor.
creates a Rigid Body in an OgreNewt::World, based on a specific collision shape.
W | pointer to the OgreNewt::World/ |
col | pointer to an OgreNewt::Collision object that represents the shape of the rigid body. |
bodytype | simple integer value used to identify the type of rigid body, useful for determining bodies in callbacks. |
Definition at line 13 of file OgreNewt_Body.cpp.
OgreNewt::Body::~Body | ( | ) |
destructor
Definition at line 72 of file OgreNewt_Body.cpp.
|
inline |
add force to the body.
this function is only valid inside a ForceCallback function!
Definition at line 505 of file OgreNewt_Body.h.
void OgreNewt::Body::addGlobalForce | ( | const Ogre::Vector3 & | force, |
const Ogre::Vector3 & | pos | ||
) |
helper function that adds a force (and resulting torque) to an object in global cordinates.
this function is only valid inside a ForceCallback function!
force | vector representing force, in global space |
pos | vector representing location of force, in global space |
Definition at line 707 of file OgreNewt_Body.cpp.
void OgreNewt::Body::addGlobalForceAccumulate | ( | const Ogre::Vector3 & | force, |
const Ogre::Vector3 & | pos | ||
) |
helper function that adds a force (and resulting torque) to an object in global cordinates called from anywhere.
this function can also be called outside ForceCallback function, the calls are accumulated and applied in the callback.
force | vector representing force, in global space |
pos | vector representing location of force, in global space |
Definition at line 723 of file OgreNewt_Body.cpp.
|
inline |
get the freeze threshold
add an impulse (relative change in velocity) to a body. values are in world coordinates.
Definition at line 487 of file OgreNewt_Body.h.
void OgreNewt::Body::addLocalForce | ( | const Ogre::Vector3 & | force, |
const Ogre::Vector3 & | pos | ||
) |
this function is only valid inside a ForceCallback function!
force | vector representing force, in local space of the body |
pos | vector representing locatino of force, in local space of the body |
Definition at line 728 of file OgreNewt_Body.cpp.
|
inline |
add torque to the body.
this function is only valid inside a ForceCallback function!
Definition at line 519 of file OgreNewt_Body.h.
void OgreNewt::Body::attachNode | ( | Ogre::Node * | node | ) |
attach this body to an Ogre::Node*
This is an easy way to connect a Rigid Body with an Ogre::Node. this automatically sets up a standard Transform callback when you call this. after calling this, the Ogre::Node will have its position orientation updated to that of the Rigid Body each time you call World::update(), and the body has moved during the update.
Definition at line 224 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::calculateInertialMatrix | ( | ) | const |
Definition at line 689 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::calculateInverseDynamicsForce | ( | Ogre::Real | timestep, |
Ogre::Vector3 | desiredVelocity | ||
) |
calculate force needed for given velocity
Definition at line 623 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::calculateOffset | ( | ) | const |
Definition at line 671 of file OgreNewt_Body.cpp.
void OgreNewt::Body::enableSimulation | ( | bool | state | ) |
Definition at line 231 of file OgreNewt_Body.cpp.
|
inline |
freeze the rigid body.
this command "freezes" the Rigid Body, removing it from the active simulation list. it will "unfreeze" if another body comes in contact with it, or you "unfreeze" it.
Definition at line 295 of file OgreNewt_Body.h.
Ogre::AxisAlignedBox OgreNewt::Body::getAABB | ( | ) | const |
get the axis-aligned bounding box for this body.
Definition at line 465 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getAngularDamping | ( | ) | const |
get angular damping
Definition at line 643 of file OgreNewt_Body.cpp.
|
inline |
get whether the body should "sleep" when equilibrium is reached.
Definition at line 378 of file OgreNewt_Body.h.
Ogre::Vector3 OgreNewt::Body::getCenterOfMass | ( | ) | const |
get the center of mass.
returns the current center of mass, as an offset from the original origin when the body was created.
Definition at line 657 of file OgreNewt_Body.cpp.
const OgreNewt::CollisionPtr & OgreNewt::Body::getCollision | ( | ) | const |
set the factors that cause a body to "freeze" when equilibrium reached.
get a pointer to the OgreNewt::Collision for this body
Definition at line 393 of file OgreNewt_Body.cpp.
|
inline |
Returns the Collisiontype for the Collision from this Body.
usually it is also possible to get this via: body->getCollision()->getCollisionPrimitiveType()
Definition at line 589 of file OgreNewt_Body.h.
|
inline |
returns current setting for this body.
Definition at line 415 of file OgreNewt_Body.h.
Ogre::Vector3 OgreNewt::Body::getForce | ( | ) | const |
get the force acting on the body.
Definition at line 563 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getForceAcceleration | ( | ) | const |
get the linear acceleration due to forces acting on the body.
Definition at line 593 of file OgreNewt_Body.cpp.
|
inline |
returns correct force-torque callback
Definition at line 205 of file OgreNewt_Body.h.
Ogre::Vector3 OgreNewt::Body::getInertia | ( | ) | const |
return body inertia
Definition at line 508 of file OgreNewt_Body.cpp.
void OgreNewt::Body::getInvMass | ( | Ogre::Real & | mass, |
Ogre::Vector3 & | inertia | ||
) | const |
get invert mass + inertia for the body.
Definition at line 521 of file OgreNewt_Body.cpp.
|
inline |
returns current setting for this body.
Definition at line 418 of file OgreNewt_Body.h.
|
inline |
get linear damping
Definition at line 475 of file OgreNewt_Body.h.
Ogre::Real OgreNewt::Body::getMass | ( | ) | const |
return body mass
Definition at line 499 of file OgreNewt_Body.cpp.
void OgreNewt::Body::getMassMatrix | ( | Ogre::Real & | mass, |
Ogre::Vector3 & | inertia | ||
) | const |
get Ogre::Real(mass) and Ogre::Vector3(inertia) of the body.
Definition at line 487 of file OgreNewt_Body.cpp.
const OgreNewt::MaterialID * OgreNewt::Body::getMaterialGroupID | ( | ) | const |
get a pointer to the Material assigned to this body.
Definition at line 399 of file OgreNewt_Body.cpp.
|
inline |
get a pointer to the NewtonBody object
this is the NewtonBody used by the Newton SDK. in most cases you shouldn't need to access this.
Definition at line 127 of file OgreNewt_Body.h.
|
inline |
Returns the Newton Collision for this Body.
usually it is also possible to get this via: body->getCollision()
Definition at line 595 of file OgreNewt_Body.h.
Body * OgreNewt::Body::getNext | ( | ) | const |
use this function to iterate through all bodies
Definition at line 741 of file OgreNewt_Body.cpp.
|
inline |
get a pointer to the attached Node.
if you have "attached" an Ogre::Node to this body, this retrieves the node.
Definition at line 133 of file OgreNewt_Body.h.
Ogre::Vector3 OgreNewt::Body::getOmega | ( | ) | const |
get omega of the body. in global space.
Definition at line 533 of file OgreNewt_Body.cpp.
Ogre::Quaternion OgreNewt::Body::getOrientation | ( | ) | const |
returns body orientation
Definition at line 442 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getPosition | ( | ) | const |
returns body position
Definition at line 436 of file OgreNewt_Body.cpp.
void OgreNewt::Body::getPositionOrientation | ( | Ogre::Vector3 & | pos, |
Ogre::Quaternion & | orient | ||
) | const |
get position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation)
Definition at line 425 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getTorque | ( | ) | const |
get the torque acting on the body.
Definition at line 578 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getTorqueAcceleration | ( | ) | const |
get the rotational acceleration due to torque acting on the body.
Definition at line 608 of file OgreNewt_Body.cpp.
|
inline |
get the type set for this body.
Definition at line 146 of file OgreNewt_Body.h.
|
inline |
retrieve pointer to previously set user data.
Definition at line 118 of file OgreNewt_Body.h.
|
inline |
Definition at line 120 of file OgreNewt_Body.h.
Ogre::Vector3 OgreNewt::Body::getVelocity | ( | ) | const |
get velocity of the body. in global coordinates.
Definition at line 548 of file OgreNewt_Body.cpp.
Ogre::Quaternion OgreNewt::Body::getVisualOrientation | ( | ) | const |
returns body visual orientation
Definition at line 460 of file OgreNewt_Body.cpp.
Ogre::Vector3 OgreNewt::Body::getVisualPosition | ( | ) | const |
return body visual position
Definition at line 454 of file OgreNewt_Body.cpp.
void OgreNewt::Body::getVisualPositionOrientation | ( | Ogre::Vector3 & | pos, |
Ogre::Quaternion & | orient | ||
) | const |
get the node position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation)
this function should be used for calculating Render matrix render or anything related to render time
Definition at line 448 of file OgreNewt_Body.cpp.
|
inline |
get a pointer to the OgreNewt::World this body belongs to.
Definition at line 136 of file OgreNewt_Body.h.
|
inline |
is the body freezed?
Definition at line 304 of file OgreNewt_Body.h.
|
inline |
Return if an node update was requested.
Definition at line 608 of file OgreNewt_Body.h.
|
inline |
Definition at line 381 of file OgreNewt_Body.h.
void OgreNewt::Body::MoveToPosition | ( | const Ogre::Vector3 & | destPos, |
const Ogre::Real & | stiffness, | ||
Ogre::Real | timestep | ||
) |
Definition at line 820 of file OgreNewt_Body.cpp.
|
inline |
remove any force callbacks.
Definition at line 202 of file OgreNewt_Body.h.
|
inline |
remove any transform callbacks.
Definition at line 232 of file OgreNewt_Body.h.
|
inline |
remove any transform callbacks.
Definition at line 223 of file OgreNewt_Body.h.
void OgreNewt::Body::requestNodeUpdate | ( | int | threadIndex, |
bool | forceNodeUpdate = false |
||
) |
Call this to signify that the position/orientation of the attached node needs to be updated.
This function actually adds this body to a list of bodies that need to be updated. This is done automaticalle after the next world update using the updateNode method. This function is needed for multithreading support
forceNodeUpdate | even request an update if there's already an update request |
void OgreNewt::Body::RotateToOrientation | ( | const Ogre::Quaternion & | destquat, |
const Ogre::Real & | stiffness, | ||
Ogre::Real | timestep | ||
) |
Definition at line 860 of file OgreNewt_Body.cpp.
|
inline |
set the angular damping for the body.
Definition at line 355 of file OgreNewt_Body.h.
|
inline |
set whether the body should "sleep" when equilibruim is reached.
user-controlled bodies should disable sleeping, because frozen bodies' callbacks are not called... so a callback that implements motion based on user input will not be called!
Definition at line 375 of file OgreNewt_Body.h.
|
inline |
set the body's center of mass
Set a new center of mass for the body that is different than the current, without offsetting the body. You can use this to adjust the center of mass of a body at runtime.
Definition at line 271 of file OgreNewt_Body.h.
void OgreNewt::Body::setCollision | ( | const OgreNewt::CollisionPtr & | col | ) |
set the collision that represents the shape of the body
This can be used to change the collision shape of a body mid-simulation. for example making the collision for a character smaller when crouching, etc.
col | pointer to the new OgreNewt::Collision shape. |
Definition at line 384 of file OgreNewt_Body.cpp.
|
inline |
prevents fast moving bodies from "tunneling" through other bodies.
continuous collision is an advanced feature that prevents fast moving bodies from "tunneling" (missing collision) with other bodies. there is a performance hit envolved, so this feature should only be used for bodies that have a high likelyhood of tunneling.
note that continuous collision can also be set on a per-material basis via the MaterialPair class.
Definition at line 325 of file OgreNewt_Body.h.
void OgreNewt::Body::setCustomForceAndTorqueCallback | ( | ForceCallback | callback | ) |
set a custom force callback for this body to use.
Definition at line 339 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 178 of file OgreNewt_Body.h.
|
inline |
set the force for a body.
this function is only valid inside a ForceCallback function!
Definition at line 533 of file OgreNewt_Body.h.
|
inline |
set whether all parent/children pairs connected to this body should be allowed to collide.
Definition at line 328 of file OgreNewt_Body.h.
|
inline |
set the linear damping for the body.
Definition at line 352 of file OgreNewt_Body.h.
void OgreNewt::Body::setMass | ( | Ogre::Real | mass | ) |
Definition at line 323 of file OgreNewt_Body.cpp.
void OgreNewt::Body::setMassMatrix | ( | Ogre::Real | mass, |
const Ogre::Vector3 & | inertia | ||
) |
set the mass and inertia for the body.
Set the mass of the Rigid Body. Inertia is also set here. Inertia represents a body's "resistance" to rotation around the 3 primary axis. OgreNewt has a few utility functions that can help you calculate these values based on several primitive shapes.
mass | real value for the body mass |
inertia | vector representing body moment of inertia |
Definition at line 314 of file OgreNewt_Body.cpp.
|
inline |
set the material for the body
Materials are an extremely powerful way to control body behavior. first create a new MaterialID object, and then pass a pointer to apply that material to the body.
ID | pointer to an OgreNewt::MaterialID object to use as the material for the body. |
Definition at line 312 of file OgreNewt_Body.h.
void OgreNewt::Body::setNodeUpdateJointNotify | ( | NodeUpdateNotifyCallback | callback | ) |
Definition at line 755 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 226 of file OgreNewt_Body.h.
void OgreNewt::Body::setNodeUpdateNotify | ( | NodeUpdateNotifyCallback | callback | ) |
set a custom node update notify.
Definition at line 750 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 217 of file OgreNewt_Body.h.
|
inline |
set an arbitrary omega for the body.
again, setting velocity/omega directly for a body in realtime is not recommended for proper physics behavior. this function is intended to be used to setup a Body initially.
omega | vector representing the desired omega (rotational velocity) |
Definition at line 335 of file OgreNewt_Body.h.
void OgreNewt::Body::setPositionOrientation | ( | const Ogre::Vector3 & | pos, |
const Ogre::Quaternion & | orient, | ||
int | threadIndex = -1 |
||
) |
position and orient the body arbitrarily.
generally in a physics engine you shouldn't directly set the location/rotation of a Body, because this defies physics laws. this command exists to set up bodies initially.
orient | quaternion representing body orientation in world space. |
pos | vector representing body position in world space. |
threadIndex | only set the thread-index if you don't want the node to be updated immediatly but queued (Ogre doesn't support modifying nodes from several threads) |
Definition at line 248 of file OgreNewt_Body.cpp.
void OgreNewt::Body::setPositionOrientationFromNode | ( | int | threadIndex = -1 | ) |
position and orient the body from node.
generally in a physics engine you shouldn't directly set the location/rotation of a Body, because this defies physics laws. this command exists to set up bodies initially.
orient | quaternion representing body orientation in world space. |
pos | vector representing body position in world space. |
threadIndex | only set the thread-index if you don't want the node to be updated immediatly but queued (Ogre doesn't support modifying nodes from several threads) |
Definition at line 291 of file OgreNewt_Body.cpp.
void OgreNewt::Body::setScale | ( | const Ogre::Vector3 & | scale, |
const Ogre::Quaternion & | orient, | ||
Ogre::Vector3 & | pos | ||
) |
set the collision scale
Definition at line 407 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 383 of file OgreNewt_Body.h.
void OgreNewt::Body::setStandardForceCallback | ( | ) |
set a standard gravity callback for this body to use.
This sets a very basic force callback for this body, that simply applies a standard 9,8m/s^2 gravity force to the body. in most cases you will need more forces acting on your Rigid Bodies, which you accomplish through custom force callbacks.
Definition at line 333 of file OgreNewt_Body.cpp.
|
inline |
set the torque for a body.
this function is only valid inside a ForceCallback function!
Definition at line 547 of file OgreNewt_Body.h.
|
inline |
Definition at line 184 of file OgreNewt_Body.h.
void OgreNewt::Body::setTriggerEnterCallback | ( | TriggerEnterCallback | callback | ) |
Definition at line 352 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 196 of file OgreNewt_Body.h.
void OgreNewt::Body::setTriggerExitCallback | ( | TriggerExitCallback | callback | ) |
Definition at line 362 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 190 of file OgreNewt_Body.h.
void OgreNewt::Body::setTriggerInsideCallback | ( | TriggerInsideCallback | callback | ) |
Definition at line 357 of file OgreNewt_Body.cpp.
|
inline |
set the type for this body.
this sets the "type" for the body, which can also be set in the constructor.
type | integer value to represent the type of body, e.g. "FLOOR" or "CANON BALL", etc. used for differentation in material callbacks. |
Definition at line 143 of file OgreNewt_Body.h.
|
inline |
set user data to connect this class to another.
you can use this to store a pointer to a parent class, etc. then inside one of the many callbacks, you can get the pointer using this "userData" system.
Definition at line 111 of file OgreNewt_Body.h.
|
inline |
Definition at line 113 of file OgreNewt_Body.h.
void OgreNewt::Body::setVelocity | ( | const Ogre::Vector3 & | vel | ) |
set an arbitrary velocity for the body.
again, setting velocity/omega directly for a body in realtime is not recommended for proper physics behavior. this function is intended to be used to setup a Body initially.
vel | vector representing the desired velocity. |
Definition at line 807 of file OgreNewt_Body.cpp.
void OgreNewt::Body::setVisualPosition | ( | Ogre::Vector3 | pos, |
Ogre::Quaternion | quat | ||
) |
Definition at line 760 of file OgreNewt_Body.cpp.
|
inline |
void OgreNewt::Body::updateNode | ( | Ogre::Real | interpolatParam | ) |
update the position of the node (if attached) and sets m_nodeupdateneeded to false
Definition at line 766 of file OgreNewt_Body.cpp.
void OgreNewt::Body::updatePositionOrientation | ( | const Ogre::Vector3 & | pos, |
const Ogre::Quaternion & | orient, | ||
int | threadIndex = -1 |
||
) |
Definition at line 270 of file OgreNewt_Body.cpp.
|
inline |
Definition at line 390 of file OgreNewt_Body.h.
|
protected |
Definition at line 632 of file OgreNewt_Body.h.
|
protected |
Definition at line 627 of file OgreNewt_Body.h.
|
protected |
Definition at line 628 of file OgreNewt_Body.h.
|
protected |
Definition at line 634 of file OgreNewt_Body.h.
|
protected |
Definition at line 638 of file OgreNewt_Body.h.
|
protected |
Definition at line 652 of file OgreNewt_Body.h.
|
protected |
Definition at line 629 of file OgreNewt_Body.h.
|
protected |
Definition at line 649 of file OgreNewt_Body.h.
|
protected |
Definition at line 633 of file OgreNewt_Body.h.
|
protected |
Definition at line 637 of file OgreNewt_Body.h.
|
protected |
Definition at line 658 of file OgreNewt_Body.h.
|
protected |
Definition at line 657 of file OgreNewt_Body.h.
|
protected |
Definition at line 635 of file OgreNewt_Body.h.
|
protected |
Definition at line 639 of file OgreNewt_Body.h.
|
protected |
Definition at line 636 of file OgreNewt_Body.h.
|
protected |
Definition at line 653 of file OgreNewt_Body.h.
|
protected |
Definition at line 655 of file OgreNewt_Body.h.
|
protected |
Definition at line 654 of file OgreNewt_Body.h.
|
protected |
Definition at line 648 of file OgreNewt_Body.h.
|
protected |
Definition at line 643 of file OgreNewt_Body.h.
|
protected |
Definition at line 645 of file OgreNewt_Body.h.
|
protected |
Definition at line 630 of file OgreNewt_Body.h.