SO3Engine
|
OgreNewt_Body.h
Go to the documentation of this file.
6 OgreNewt basically has no license, you may use any or all of the library however you desire... I hope it can help you in any way.
9 please note that the "boost" library files included here are not of my creation, refer to those files and boost.org for information.
49 typedef std::function<void(OgreNewt::Body*, Ogre::Real timeStep, int threadIndex)> ForceCallback;
60 The application can use this function to re calculate relative position of child nodes, or any other depended transform.
63 Using std::function means OgreNewt can now accept pointers to member functions of specific classes.
77 //typedef std::function<void(OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, int threadIndex)> TransformCallback;
91 typedef std::function<bool(dLong, OgreNewt::Body*, const Ogre::Quaternion&, const Ogre::Vector3&, Ogre::Plane&)> buoyancyPlaneCallback;
100 Body(World* const W, const OgreNewt::CollisionPtr& col, int bodytype = 0, bool trigger = false);
165 This specifies a custom callback to use for applying forces to a body. if you are using a standard non-member function, or a static member function, you can simply pass a pointer to the function here.. like this:
168 If you want to bind to a class member, you also need to pass a pointer to the class itself, using the std::bind system, like so:
169 setCustomForceAndTorqueCallback( std::bind( &MyClass::myCallback, (MyClass*)classInstance, std::placeholders::_1 ) ); (from outside the class) or:
170 setCustomForceAndTorqueCallback( std::bind( &MyClass::myCallback, this, std::placeholders::_1 ) ); (from inside the class).
173 setCustomForceAndTorqueCallback<>( &MyClass::myCallback, (MyClass*)classInstance ); (from outside the class) or:
178 template<class c> void setCustomForceAndTorqueCallback(std::function<void(c*, Body*, float, int)> callback, c *instancedClassPointer)
184 template<class c> void setTriggerEnterCallback(std::function<void(c*, Body*)> callback, c *instancedClassPointer)
190 template<class c> void setTriggerInsideCallback(std::function<void(c*, Body*)> callback, c *instancedClassPointer)
196 template<class c> void setTriggerExitCallback(std::function<void(c*, Body*)> callback, c *instancedClassPointer)
202 void removeForceAndTorqueCallback() { NewtonBodySetForceAndTorqueCallback(m_body, NULL); m_forcecallback = NULL; }
213 set a function pointer to be called for function nodeUpdate when the application desires to be notified that this node is bing updated.
214 Control joints like the vehicle an drag dolls use the function to calculate the correct matrix of wheels and body parts.
217 template<class c> void setNodeUpdateNotify(std::function<void(c*, OgreNewt::Body*)> callback, c *instancedClassPointer)
226 template<class c> void setNodeUpdateJointNotify(std::function<void(c*, OgreNewt::Body*)> callback, c *instancedClassPointer)
241 void setPositionOrientation(const Ogre::Vector3& pos, const Ogre::Quaternion& orient, int threadIndex = -1);
252 void updatePositionOrientation(const Ogre::Vector3& pos, const Ogre::Quaternion& orient, int threadIndex = -1);
325 void setContinuousCollisionMode(unsigned state) { NewtonBodySetContinuousCollisionMode(m_body, state); }
328 void setJointRecursiveCollision(unsigned state) { NewtonBodySetJointRecursiveCollision(m_body, state); }
403 //void setFreezeThreshold( Ogre::Real speed, Ogre::Real omega, int framecount ) { NewtonBodySetFreezeTreshold( m_body, (float)speed, (float)omega, framecount ); }
481 Ogre::Vector3 calculateInverseDynamicsForce(Ogre::Real timestep, Ogre::Vector3 desiredVelocity);
484 //void getFreezeThreshold( Ogre::Real& speed, Ogre::Real& omega ) const { NewtonBodyGetFreezeTreshold( m_body, &speed, &omega ); }
589 CollisionPrimitiveType getCollisionPrimitiveType() const { return Collision::getCollisionPrimitiveType(getNewtonCollision()); }
622 void MoveToPosition(const Ogre::Vector3 &destPos, const Ogre::Real &stiffness, Ogre::Real timestep);
623 void RotateToOrientation(const Ogre::Quaternion &destquat, const Ogre::Real &stiffness, Ogre::Real timestep);
664 static void _CDECL newtonTransformCallback(const NewtonBody* body, const dFloat* matrix, int threadIndex);
helper class: OgreNewt-classes can derive from this class to implement a destructor-callback
Definition OgreNewt_Prerequisites.h:94
CollisionPrimitiveType getCollisionPrimitiveType() const
Returns the Collisiontype for the Collision from this Body.
Definition OgreNewt_Body.h:589
void setTriggerEnterCallback(std::function< void(c *, Body *)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:184
const Ogre::Any & getUserData() const
retrieve pointer to previously set user data.
Definition OgreNewt_Body.h:118
void setContinuousCollisionMode(unsigned state)
prevents fast moving bodies from "tunneling" through other bodies.
Definition OgreNewt_Body.h:325
void setUserData(const Ogre::Any &data)
set user data to connect this class to another.
Definition OgreNewt_Body.h:111
void setCustomForceAndTorqueCallback(std::function< void(c *, Body *, float, int)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:178
OgreNewt::World *const getWorld() const
get a pointer to the OgreNewt::World this body belongs to.
Definition OgreNewt_Body.h:136
void setAngularDamping(const Ogre::Vector3 &damp)
set the angular damping for the body.
Definition OgreNewt_Body.h:355
void setMaterialGroupID(const MaterialID *ID)
set the material for the body
Definition OgreNewt_Body.h:312
void addImpulse(const Ogre::Vector3 &deltav, const Ogre::Vector3 &posit)
get the freeze threshold
Definition OgreNewt_Body.h:487
int getAutoSleep()
get whether the body should "sleep" when equilibrium is reached.
Definition OgreNewt_Body.h:378
TriggerInsideCallback m_triggerInsideCallback
Definition OgreNewt_Body.h:654
void setNodeUpdateJointNotify(std::function< void(c *, OgreNewt::Body *)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:226
std::function< void(OgreNewt::Body *)> TriggerEnterCallback
Definition OgreNewt_Body.h:51
void requestNodeUpdate(int threadIndex, bool forceNodeUpdate=false)
Call this to signify that the position/orientation of the attached node needs to be updated.
void setTriggerInsideCallback(std::function< void(c *, Body *)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:190
TriggerEnterCallback m_triggerEnterCallback
Definition OgreNewt_Body.h:653
void setTriggerExitCallback(std::function< void(c *, Body *)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:196
std::function< void(OgreNewt::Body *)> TriggerExitCallback
Definition OgreNewt_Body.h:53
NodeUpdateNotifyCallback m_nodeupdatejointnotifycallback
Definition OgreNewt_Body.h:658
std::function< void(OgreNewt::Body *)> NodeUpdateNotifyCallback
node update notify.
Definition OgreNewt_Body.h:65
std::function< void(OgreNewt::Body *, Ogre::Real timeStep, int threadIndex)> ForceCallback
custom force callback.
Definition OgreNewt_Body.h:49
int getJointRecursiveCollision() const
returns current setting for this body.
Definition OgreNewt_Body.h:418
std::vector< std::pair< Ogre::Vector3, Ogre::Vector3 > > m_accumulatedGlobalForces
Definition OgreNewt_Body.h:632
NewtonBody * getNewtonBody() const
get a pointer to the NewtonBody object
Definition OgreNewt_Body.h:127
TriggerExitCallback m_triggerExitCallback
Definition OgreNewt_Body.h:655
void setNodeUpdateNotify(std::function< void(c *, OgreNewt::Body *)> callback, c *instancedClassPointer)
Definition OgreNewt_Body.h:217
NodeUpdateNotifyCallback m_nodeupdatenotifycallback
Definition OgreNewt_Body.h:657
int getContinuousCollisionMode() const
returns current setting for this body.
Definition OgreNewt_Body.h:415
bool isNodeUpdateNeeded() const
Return if an node update was requested.
Definition OgreNewt_Body.h:608
void setOmega(const Ogre::Vector3 &omega)
set an arbitrary omega for the body.
Definition OgreNewt_Body.h:335
void setLinearDamping(Ogre::Real damp)
set the linear damping for the body.
Definition OgreNewt_Body.h:352
void setJointRecursiveCollision(unsigned state)
set whether all parent/children pairs connected to this body should be allowed to collide.
Definition OgreNewt_Body.h:328
std::function< bool(dLong, OgreNewt::Body *, const Ogre::Quaternion &, const Ogre::Vector3 &, Ogre::Plane &)> buoyancyPlaneCallback
custom transform callback.
Definition OgreNewt_Body.h:91
ForceCallback getForceTorqueCallback()
returns correct force-torque callback
Definition OgreNewt_Body.h:205
std::function< void(OgreNewt::Body *)> TriggerInsideCallback
Definition OgreNewt_Body.h:52
NewtonCollision * getNewtonCollision() const
Returns the Newton Collision for this Body.
Definition OgreNewt_Body.h:595
void setAutoSleep(int flag)
set whether the body should "sleep" when equilibruim is reached.
Definition OgreNewt_Body.h:375
void setCenterOfMass(const Ogre::Vector3 ¢erOfMass)
set the body's center of mass
Definition OgreNewt_Body.h:271
Generated by 1.9.8