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 |
Detailed Description
main class for all Rigid Bodies in the system.
Definition at line 38 of file OgreNewt_Body.h.
Member Typedef Documentation
◆ buoyancyPlaneCallback
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.
◆ ForceCallback
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.
◆ NodeUpdateNotifyCallback
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::NodeUpdateNotifyCallback |
node update notify.
Definition at line 65 of file OgreNewt_Body.h.
◆ TriggerEnterCallback
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerEnterCallback |
Definition at line 51 of file OgreNewt_Body.h.
◆ TriggerExitCallback
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerExitCallback |
Definition at line 53 of file OgreNewt_Body.h.
◆ TriggerInsideCallback
typedef std::function<void(OgreNewt::Body*)> OgreNewt::Body::TriggerInsideCallback |
Definition at line 52 of file OgreNewt_Body.h.
Constructor & Destructor Documentation
◆ Body()
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.
- Parameters
-
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.
◆ ~Body()
OgreNewt::Body::~Body | ( | ) |
destructor
Definition at line 72 of file OgreNewt_Body.cpp.
Member Function Documentation
◆ addForce()
|
inline |
add force to the body.
this function is only valid inside a ForceCallback function!
Definition at line 505 of file OgreNewt_Body.h.
◆ addGlobalForce()
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!
- Parameters
-
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.
◆ addGlobalForceAccumulate()
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.
- Parameters
-
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.
◆ addImpulse()
|
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.
◆ addLocalForce()
void OgreNewt::Body::addLocalForce | ( | const Ogre::Vector3 & | force, |
const Ogre::Vector3 & | pos | ||
) |
this function is only valid inside a ForceCallback function!
- Parameters
-
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.
◆ addTorque()
|
inline |
add torque to the body.
this function is only valid inside a ForceCallback function!
Definition at line 519 of file OgreNewt_Body.h.
◆ attachNode()
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.
◆ calculateInertialMatrix()
Ogre::Vector3 OgreNewt::Body::calculateInertialMatrix | ( | ) | const |
Definition at line 689 of file OgreNewt_Body.cpp.
◆ calculateInverseDynamicsForce()
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.
◆ calculateOffset()
Ogre::Vector3 OgreNewt::Body::calculateOffset | ( | ) | const |
Definition at line 671 of file OgreNewt_Body.cpp.
◆ enableSimulation()
void OgreNewt::Body::enableSimulation | ( | bool | state | ) |
Definition at line 231 of file OgreNewt_Body.cpp.
◆ freeze()
|
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.
- See also
- unFreeze()
Definition at line 295 of file OgreNewt_Body.h.
◆ getAABB()
Ogre::AxisAlignedBox OgreNewt::Body::getAABB | ( | ) | const |
get the axis-aligned bounding box for this body.
Definition at line 465 of file OgreNewt_Body.cpp.
◆ getAngularDamping()
Ogre::Vector3 OgreNewt::Body::getAngularDamping | ( | ) | const |
get angular damping
Definition at line 643 of file OgreNewt_Body.cpp.
◆ getAutoSleep()
|
inline |
get whether the body should "sleep" when equilibrium is reached.
Definition at line 378 of file OgreNewt_Body.h.
◆ getCenterOfMass()
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.
◆ getCollision()
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.
◆ getCollisionPrimitiveType()
|
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.
◆ getContinuousCollisionMode()
|
inline |
returns current setting for this body.
Definition at line 415 of file OgreNewt_Body.h.
◆ getForce()
Ogre::Vector3 OgreNewt::Body::getForce | ( | ) | const |
get the force acting on the body.
Definition at line 563 of file OgreNewt_Body.cpp.
◆ getForceAcceleration()
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.
◆ getForceTorqueCallback()
|
inline |
returns correct force-torque callback
Definition at line 205 of file OgreNewt_Body.h.
◆ getInertia()
Ogre::Vector3 OgreNewt::Body::getInertia | ( | ) | const |
return body inertia
Definition at line 508 of file OgreNewt_Body.cpp.
◆ getInvMass()
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.
◆ getJointRecursiveCollision()
|
inline |
returns current setting for this body.
Definition at line 418 of file OgreNewt_Body.h.
◆ getLinearDamping()
|
inline |
get linear damping
Definition at line 475 of file OgreNewt_Body.h.
◆ getMass()
Ogre::Real OgreNewt::Body::getMass | ( | ) | const |
return body mass
Definition at line 499 of file OgreNewt_Body.cpp.
◆ getMassMatrix()
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.
◆ getMaterialGroupID()
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.
◆ getNewtonBody()
|
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.
◆ getNewtonCollision()
|
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.
◆ getNext()
Body * OgreNewt::Body::getNext | ( | ) | const |
use this function to iterate through all bodies
Definition at line 741 of file OgreNewt_Body.cpp.
◆ getOgreNode()
|
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.
◆ getOmega()
Ogre::Vector3 OgreNewt::Body::getOmega | ( | ) | const |
get omega of the body. in global space.
Definition at line 533 of file OgreNewt_Body.cpp.
◆ getOrientation()
Ogre::Quaternion OgreNewt::Body::getOrientation | ( | ) | const |
returns body orientation
Definition at line 442 of file OgreNewt_Body.cpp.
◆ getPosition()
Ogre::Vector3 OgreNewt::Body::getPosition | ( | ) | const |
returns body position
Definition at line 436 of file OgreNewt_Body.cpp.
◆ getPositionOrientation()
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.
◆ getTorque()
Ogre::Vector3 OgreNewt::Body::getTorque | ( | ) | const |
get the torque acting on the body.
Definition at line 578 of file OgreNewt_Body.cpp.
◆ getTorqueAcceleration()
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.
◆ getType()
|
inline |
get the type set for this body.
Definition at line 146 of file OgreNewt_Body.h.
◆ getUserData() [1/2]
|
inline |
retrieve pointer to previously set user data.
Definition at line 118 of file OgreNewt_Body.h.
◆ getUserData() [2/2]
|
inline |
Definition at line 120 of file OgreNewt_Body.h.
◆ getVelocity()
Ogre::Vector3 OgreNewt::Body::getVelocity | ( | ) | const |
get velocity of the body. in global coordinates.
Definition at line 548 of file OgreNewt_Body.cpp.
◆ getVisualOrientation()
Ogre::Quaternion OgreNewt::Body::getVisualOrientation | ( | ) | const |
returns body visual orientation
Definition at line 460 of file OgreNewt_Body.cpp.
◆ getVisualPosition()
Ogre::Vector3 OgreNewt::Body::getVisualPosition | ( | ) | const |
return body visual position
Definition at line 454 of file OgreNewt_Body.cpp.
◆ getVisualPositionOrientation()
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.
◆ getWorld()
|
inline |
get a pointer to the OgreNewt::World this body belongs to.
Definition at line 136 of file OgreNewt_Body.h.
◆ isFreezed()
|
inline |
is the body freezed?
Definition at line 304 of file OgreNewt_Body.h.
◆ isNodeUpdateNeeded()
|
inline |
Return if an node update was requested.
Definition at line 608 of file OgreNewt_Body.h.
◆ isSleeping()
|
inline |
Definition at line 381 of file OgreNewt_Body.h.
◆ MoveToPosition()
void OgreNewt::Body::MoveToPosition | ( | const Ogre::Vector3 & | destPos, |
const Ogre::Real & | stiffness, | ||
Ogre::Real | timestep | ||
) |
Definition at line 820 of file OgreNewt_Body.cpp.
◆ removeForceAndTorqueCallback()
|
inline |
remove any force callbacks.
Definition at line 202 of file OgreNewt_Body.h.
◆ removeNodeUpdateJointNotify()
|
inline |
remove any transform callbacks.
Definition at line 232 of file OgreNewt_Body.h.
◆ removeNodeUpdateNotify()
|
inline |
remove any transform callbacks.
Definition at line 223 of file OgreNewt_Body.h.
◆ requestNodeUpdate()
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
- Parameters
-
forceNodeUpdate even request an update if there's already an update request
◆ RotateToOrientation()
void OgreNewt::Body::RotateToOrientation | ( | const Ogre::Quaternion & | destquat, |
const Ogre::Real & | stiffness, | ||
Ogre::Real | timestep | ||
) |
Definition at line 860 of file OgreNewt_Body.cpp.
◆ setAngularDamping()
|
inline |
set the angular damping for the body.
Definition at line 355 of file OgreNewt_Body.h.
◆ setAutoSleep()
|
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.
◆ setCenterOfMass()
|
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.
◆ setCollision()
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.
- Parameters
-
col pointer to the new OgreNewt::Collision shape.
Definition at line 384 of file OgreNewt_Body.cpp.
◆ setContinuousCollisionMode()
|
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.
◆ setCustomForceAndTorqueCallback() [1/2]
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.
◆ setCustomForceAndTorqueCallback() [2/2]
|
inline |
Definition at line 178 of file OgreNewt_Body.h.
◆ setForce()
|
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.
◆ setJointRecursiveCollision()
|
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.
◆ setLinearDamping()
|
inline |
set the linear damping for the body.
Definition at line 352 of file OgreNewt_Body.h.
◆ setMass()
void OgreNewt::Body::setMass | ( | Ogre::Real | mass | ) |
Definition at line 323 of file OgreNewt_Body.cpp.
◆ setMassMatrix()
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.
- Parameters
-
mass real value for the body mass inertia vector representing body moment of inertia
Definition at line 314 of file OgreNewt_Body.cpp.
◆ setMaterialGroupID()
|
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.
- Parameters
-
ID pointer to an OgreNewt::MaterialID object to use as the material for the body.
Definition at line 312 of file OgreNewt_Body.h.
◆ setNodeUpdateJointNotify() [1/2]
void OgreNewt::Body::setNodeUpdateJointNotify | ( | NodeUpdateNotifyCallback | callback | ) |
Definition at line 755 of file OgreNewt_Body.cpp.
◆ setNodeUpdateJointNotify() [2/2]
|
inline |
Definition at line 226 of file OgreNewt_Body.h.
◆ setNodeUpdateNotify() [1/2]
void OgreNewt::Body::setNodeUpdateNotify | ( | NodeUpdateNotifyCallback | callback | ) |
set a custom node update notify.
Definition at line 750 of file OgreNewt_Body.cpp.
◆ setNodeUpdateNotify() [2/2]
|
inline |
Definition at line 217 of file OgreNewt_Body.h.
◆ setOmega()
|
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.
- Parameters
-
omega vector representing the desired omega (rotational velocity)
Definition at line 335 of file OgreNewt_Body.h.
◆ setPositionOrientation()
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.
- Parameters
-
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.
◆ setPositionOrientationFromNode()
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.
- Parameters
-
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.
◆ setScale()
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.
◆ setSleep()
|
inline |
Definition at line 383 of file OgreNewt_Body.h.
◆ setStandardForceCallback()
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.
◆ setTorque()
|
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.
◆ setTriggerEnterCallback() [1/2]
|
inline |
Definition at line 184 of file OgreNewt_Body.h.
◆ setTriggerEnterCallback() [2/2]
void OgreNewt::Body::setTriggerEnterCallback | ( | TriggerEnterCallback | callback | ) |
Definition at line 352 of file OgreNewt_Body.cpp.
◆ setTriggerExitCallback() [1/2]
|
inline |
Definition at line 196 of file OgreNewt_Body.h.
◆ setTriggerExitCallback() [2/2]
void OgreNewt::Body::setTriggerExitCallback | ( | TriggerExitCallback | callback | ) |
Definition at line 362 of file OgreNewt_Body.cpp.
◆ setTriggerInsideCallback() [1/2]
|
inline |
Definition at line 190 of file OgreNewt_Body.h.
◆ setTriggerInsideCallback() [2/2]
void OgreNewt::Body::setTriggerInsideCallback | ( | TriggerInsideCallback | callback | ) |
Definition at line 357 of file OgreNewt_Body.cpp.
◆ setType()
|
inline |
set the type for this body.
this sets the "type" for the body, which can also be set in the constructor.
- Parameters
-
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.
◆ setUserData() [1/2]
|
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.
◆ setUserData() [2/2]
|
inline |
Definition at line 113 of file OgreNewt_Body.h.
◆ setVelocity()
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.
- Parameters
-
vel vector representing the desired velocity.
Definition at line 807 of file OgreNewt_Body.cpp.
◆ setVisualPosition()
void OgreNewt::Body::setVisualPosition | ( | Ogre::Vector3 | pos, |
Ogre::Quaternion | quat | ||
) |
Definition at line 760 of file OgreNewt_Body.cpp.
◆ unFreeze()
|
inline |
◆ updateNode()
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.
◆ updatePositionOrientation()
void OgreNewt::Body::updatePositionOrientation | ( | const Ogre::Vector3 & | pos, |
const Ogre::Quaternion & | orient, | ||
int | threadIndex = -1 |
||
) |
Definition at line 270 of file OgreNewt_Body.cpp.
◆ wakeUp()
|
inline |
Definition at line 390 of file OgreNewt_Body.h.
Member Data Documentation
◆ m_accumulatedGlobalForces
|
protected |
Definition at line 632 of file OgreNewt_Body.h.
◆ m_body
|
protected |
Definition at line 627 of file OgreNewt_Body.h.
◆ m_collision
|
protected |
Definition at line 628 of file OgreNewt_Body.h.
◆ m_curPosit
|
protected |
Definition at line 634 of file OgreNewt_Body.h.
◆ m_curRotation
|
protected |
Definition at line 638 of file OgreNewt_Body.h.
◆ m_forcecallback
|
protected |
Definition at line 652 of file OgreNewt_Body.h.
◆ m_matid
|
protected |
Definition at line 629 of file OgreNewt_Body.h.
◆ m_node
|
protected |
Definition at line 649 of file OgreNewt_Body.h.
◆ m_nodePosit
|
protected |
Definition at line 633 of file OgreNewt_Body.h.
◆ m_nodeRotation
|
protected |
Definition at line 637 of file OgreNewt_Body.h.
◆ m_nodeupdatejointnotifycallback
|
protected |
Definition at line 658 of file OgreNewt_Body.h.
◆ m_nodeupdatenotifycallback
|
protected |
Definition at line 657 of file OgreNewt_Body.h.
◆ m_prevPosit
|
protected |
Definition at line 635 of file OgreNewt_Body.h.
◆ m_prevRotation
|
protected |
Definition at line 639 of file OgreNewt_Body.h.
◆ m_scale
|
protected |
Definition at line 636 of file OgreNewt_Body.h.
◆ m_triggerEnterCallback
|
protected |
Definition at line 653 of file OgreNewt_Body.h.
◆ m_triggerExitCallback
|
protected |
Definition at line 655 of file OgreNewt_Body.h.
◆ m_triggerInsideCallback
|
protected |
Definition at line 654 of file OgreNewt_Body.h.
◆ m_type
|
protected |
Definition at line 648 of file OgreNewt_Body.h.
◆ m_userdata [1/2]
|
protected |
Definition at line 643 of file OgreNewt_Body.h.
◆ m_userdata [2/2]
|
protected |
Definition at line 645 of file OgreNewt_Body.h.
◆ m_world
|
protected |
Definition at line 630 of file OgreNewt_Body.h.
The documentation for this class was generated from the following files:
- include/External/ogrenewt/OgreNewt_Body.h
- src/External/ogrenewt/OgreNewt_Body.cpp
Generated by 1.9.8