SO3Engine
|
OgreNewt_Body.cpp
Go to the documentation of this file.
50 WorldTriggerManager::TriggerCallback* const triggerCb = (WorldTriggerManager::TriggerCallback*) m_triggerController->GetUserData();
58 m_body = NewtonCreateDynamicBody(m_world->getNewtonWorld(), col->getNewtonCollision(), &matrix[0]);
129 void _CDECL Body::newtonTransformCallback(const NewtonBody* body, const dFloat* matrix, int threadIndex)
139 me->m_curPosit = Ogre::Vector3(Ogre::Real(matrix[12]), Ogre::Real(matrix[13]), Ogre::Real(matrix[14]));
186 void _CDECL Body::newtonForceTorqueCallback(const NewtonBody* body, dFloat timeStep, int threadIndex)
212 for (std::vector<std::pair<Ogre::Vector3, Ogre::Vector3> >::const_iterator it = me->m_accumulatedGlobalForces.begin(); it != me->m_accumulatedGlobalForces.end(); it++)
214 Ogre::LogManager::getSingleton().getDefaultLog()->logMessage("# [" + Ogre::StringConverter::toString(++nth) + "] force " + Ogre::StringConverter::toString(it->first) + " at " + Ogre::StringConverter::toString(it->second) + " to " + me->getOgreNode()->getName());
248 void Body::setPositionOrientation(const Ogre::Vector3& pos, const Ogre::Quaternion& orient, int threadIndex)
270 void Body::updatePositionOrientation(const Ogre::Vector3& pos, const Ogre::Quaternion& orient, int threadIndex)
319 NewtonBodySetMassMatrix(m_body, (float)mass, (float)inertia.x, (float)inertia.y, (float)inertia.z);
407 void Body::setScale(const Ogre::Vector3& scale, const Ogre::Quaternion& orient, Ogre::Vector3& pos)
623 Ogre::Vector3 Body::calculateInverseDynamicsForce(Ogre::Real timestep, Ogre::Vector3 desiredVelocity)
679 NewtonConvexCollisionCalculateInertialMatrix(NewtonBodyGetCollision(m_body), &fIner.m_x, &fOff.m_x);
697 NewtonConvexCollisionCalculateInertialMatrix(NewtonBodyGetCollision(m_body), &fIner.m_x, &fOff.m_x);
820 void Body::MoveToPosition(const Ogre::Vector3 &destPos, const Ogre::Real &stiffness, Ogre::Real timestep)
860 void Body::RotateToOrientation(const Ogre::Quaternion &destquat, const Ogre::Real &stiffness, Ogre::Real timestep)
887 Ogre::Quaternion rot(Ogre::Real(fRot.m_x), Ogre::Real(fRot.m_y), Ogre::Real(fRot.m_z), Ogre::Real(fRot.m_w));
890 dVector domega(euler.getPitch().valueRadians(), euler.getYaw().valueRadians(), euler.getRoll().valueRadians());
void MoveToPosition(const Ogre::Vector3 &destPos, const Ogre::Real &stiffness, Ogre::Real timestep)
Definition OgreNewt_Body.cpp:820
void updatePositionOrientation(const Ogre::Vector3 &pos, const Ogre::Quaternion &orient, int threadIndex=-1)
Definition OgreNewt_Body.cpp:270
void getMassMatrix(Ogre::Real &mass, Ogre::Vector3 &inertia) const
get Ogre::Real(mass) and Ogre::Vector3(inertia) of the body.
Definition OgreNewt_Body.cpp:487
const OgreNewt::CollisionPtr & getCollision() const
set the factors that cause a body to "freeze" when equilibrium reached.
Definition OgreNewt_Body.cpp:393
void setScale(const Ogre::Vector3 &scale, const Ogre::Quaternion &orient, Ogre::Vector3 &pos)
set the collision scale
Definition OgreNewt_Body.cpp:407
void setCustomForceAndTorqueCallback(ForceCallback callback)
set a custom force callback for this body to use.
Definition OgreNewt_Body.cpp:339
void setTriggerExitCallback(TriggerExitCallback callback)
Definition OgreNewt_Body.cpp:362
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 fro...
Definition OgreNewt_Body.cpp:723
void getInvMass(Ogre::Real &mass, Ogre::Vector3 &inertia) const
get invert mass + inertia for the body.
Definition OgreNewt_Body.cpp:521
void setTriggerEnterCallback(TriggerEnterCallback callback)
Definition OgreNewt_Body.cpp:352
void addLocalForce(const Ogre::Vector3 &force, const Ogre::Vector3 &pos)
Definition OgreNewt_Body.cpp:728
Ogre::Quaternion getVisualOrientation() const
returns body visual orientation
Definition OgreNewt_Body.cpp:460
const OgreNewt::MaterialID * getMaterialGroupID() const
get a pointer to the Material assigned to this body.
Definition OgreNewt_Body.cpp:399
void setNodeUpdateJointNotify(NodeUpdateNotifyCallback callback)
Definition OgreNewt_Body.cpp:755
TriggerInsideCallback m_triggerInsideCallback
Definition OgreNewt_Body.h:654
void setVisualPosition(Ogre::Vector3 pos, Ogre::Quaternion quat)
Definition OgreNewt_Body.cpp:760
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.
Definition OgreNewt_Body.cpp:707
Ogre::Vector3 getVelocity() const
get velocity of the body. in global coordinates.
Definition OgreNewt_Body.cpp:548
std::function< void(OgreNewt::Body *)> TriggerEnterCallback
Definition OgreNewt_Body.h:51
void setStandardForceCallback()
set a standard gravity callback for this body to use.
Definition OgreNewt_Body.cpp:333
TriggerEnterCallback m_triggerEnterCallback
Definition OgreNewt_Body.h:653
void updateNode(Ogre::Real interpolatParam)
update the position of the node (if attached) and sets m_nodeupdateneeded to false
Definition OgreNewt_Body.cpp:766
std::function< void(OgreNewt::Body *)> TriggerExitCallback
Definition OgreNewt_Body.h:53
void setMassMatrix(Ogre::Real mass, const Ogre::Vector3 &inertia)
set the mass and inertia for the body.
Definition OgreNewt_Body.cpp:314
Body * getNext() const
use this function to iterate through all bodies
Definition OgreNewt_Body.cpp:741
NodeUpdateNotifyCallback m_nodeupdatejointnotifycallback
Definition OgreNewt_Body.h:658
Ogre::Vector3 getOmega() const
get omega of the body. in global space.
Definition OgreNewt_Body.cpp:533
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
std::vector< std::pair< Ogre::Vector3, Ogre::Vector3 > > m_accumulatedGlobalForces
Definition OgreNewt_Body.h:632
void setPositionOrientationFromNode(int threadIndex=-1)
position and orient the body from node.
Definition OgreNewt_Body.cpp:291
Ogre::Vector3 calculateInverseDynamicsForce(Ogre::Real timestep, Ogre::Vector3 desiredVelocity)
calculate force needed for given velocity
Definition OgreNewt_Body.cpp:623
Ogre::Vector3 calculateOffset() const
Definition OgreNewt_Body.cpp:671
Body(World *const W, const OgreNewt::CollisionPtr &col, int bodytype=0, bool trigger=false)
constructor.
Definition OgreNewt_Body.cpp:13
void setPositionOrientation(const Ogre::Vector3 &pos, const Ogre::Quaternion &orient, int threadIndex=-1)
position and orient the body arbitrarily.
Definition OgreNewt_Body.cpp:248
TriggerExitCallback m_triggerExitCallback
Definition OgreNewt_Body.h:655
Ogre::Vector3 getForceAcceleration() const
get the linear acceleration due to forces acting on the body.
Definition OgreNewt_Body.cpp:593
NodeUpdateNotifyCallback m_nodeupdatenotifycallback
Definition OgreNewt_Body.h:657
void setNodeUpdateNotify(NodeUpdateNotifyCallback callback)
set a custom node update notify.
Definition OgreNewt_Body.cpp:750
Ogre::AxisAlignedBox getAABB() const
get the axis-aligned bounding box for this body.
Definition OgreNewt_Body.cpp:465
void setVelocity(const Ogre::Vector3 &vel)
set an arbitrary velocity for the body.
Definition OgreNewt_Body.cpp:807
Ogre::Vector3 calculateInertialMatrix() const
Definition OgreNewt_Body.cpp:689
Ogre::Vector3 getTorqueAcceleration() const
get the rotational acceleration due to torque acting on the body.
Definition OgreNewt_Body.cpp:608
void RotateToOrientation(const Ogre::Quaternion &destquat, const Ogre::Real &stiffness, Ogre::Real timestep)
Definition OgreNewt_Body.cpp:860
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(orien...
Definition OgreNewt_Body.cpp:448
void setCollision(const OgreNewt::CollisionPtr &col)
set the collision that represents the shape of the body
Definition OgreNewt_Body.cpp:384
std::function< void(OgreNewt::Body *)> TriggerInsideCallback
Definition OgreNewt_Body.h:52
void setTriggerInsideCallback(TriggerInsideCallback callback)
Definition OgreNewt_Body.cpp:357
void getPositionOrientation(Ogre::Vector3 &pos, Ogre::Quaternion &orient) const
get position and orientation in form of an Ogre::Vector(position) and Ogre::Quaternion(orientation)
Definition OgreNewt_Body.cpp:425
NewtonCollision *const getNewtonCollision() const
retrieve the Newton pointer
Definition OgreNewt_Collision.h:70
void DestroyController(CustomTriggerController *const controller)
Definition OgreNewt_World.cpp:90
void criticalSectionUnlock() const
notify the exit of a critical section of code.
Definition OgreNewt_World.h:359
const MaterialID * getDefaultMaterialID() const
get the default materialID object.
Definition OgreNewt_World.h:291
NewtonWorld * getNewtonWorld() const
retrieves a pointer to the NewtonWorld
Definition OgreNewt_World.h:284
void criticalSectionLock() const
notify an entrance to a critical section of code.
Definition OgreNewt_World.h:356
CustomTriggerController * CreateController(const dMatrix &matrix, NewtonCollision *const convexShape)
Definition OgreNewt_World.cpp:82
void waitForUpdateToFinish() const
Definition OgreNewt_World.h:361
void setTriggerInsideCallback(WorldTriggerInsideCallback callback)
Definition OgreNewt_World.cpp:22
void setTriggerExitCallback(WorldTriggerExitCallback callback)
Definition OgreNewt_World.cpp:27
void setTriggerEnterCallback(WorldTriggerEnterCallback callback)
Definition OgreNewt_World.cpp:17
_OgreNewtExport void QuatPosToMatrix(const Ogre::Quaternion &quat, const Ogre::Vector3 &pos, dFloat *matrix)
Take a Quaternion and Position Matrix and create a Newton-happy float matrix!
Definition OgreNewt_Tools.cpp:33
Generated by 1.9.8