SO3Engine
|
SO3Physics.cpp
Go to the documentation of this file.
87 //world->setLeaveWorldCallback(std::bind(&SPhysicWorld::LeaveWorldCallBack, this, std::placeholders::_1, std::placeholders::_2));
103 void SPhysicWorld::PreUpdate(const NewtonWorld* const world, void* const listenerUserData, dFloat timestep)
112 void SPhysicWorld::PostUpdate(const NewtonWorld* const world, void* const listenerUserData, dFloat timestep)
220 //$BB send callbacks here to be sure that no scol or other code will be executed while the physic update loop
248 // Checking if bodies are still in contact. Note that NewtonBodyGetFirstContactJoint() is not binded in OgreNewt for the moment.
288 if(((*iMaterialPairList)->getID1() == fbody0->GetMaterialID()->getID() && (*iMaterialPairList)->getID2() == fbody1->GetMaterialID()->getID())
289 ||((*iMaterialPairList)->getID2() == fbody0->GetMaterialID()->getID() && (*iMaterialPairList)->getID1() == fbody1->GetMaterialID()->getID()))
469 SBody* SPhysicWorld::PhysicsRayCast(const Ogre::Vector3& src, const Ogre::Vector3& dir, const Ogre::Real& maxdist, Ogre::Real& hitdistance, Ogre::Vector3& hitnormal)
471 OgreNewt::BasicRaycast* ray = new OgreNewt::BasicRaycast(world, src, (src + (dir.normalisedCopy() * maxdist)), true);
489 std::vector<MRAYINFO> SPhysicWorld::PhysicsRayCast(const Ogre::Vector3& src, const Ogre::Vector3& dir, const Ogre::Real& maxdist)
491 OgreNewt::BasicRaycast* ray = new OgreNewt::BasicRaycast(world, src, (src + (dir.normalisedCopy() * maxdist)), true);
517 void SPhysicWorld::SetPhysicWorldSize(const Ogre::Vector3& minsize, const Ogre::Vector3& maxsize)
614 BodyPairMap::iterator iBodyPairSearched = bodyPairMap.find(b0->GetParentNode()->GetName() + "|" + b1->GetParentNode()->GetName());
617 iBodyPairSearched = bodyPairMap.find(b1->GetParentNode()->GetName() + "|" + b0->GetParentNode()->GetName());
758 PhysicContactMap::iterator iBodyContactSearched = physicContactMap.find(b0->GetParentNode()->GetName() + "|" + b1->GetParentNode()->GetName());
760 iBodyContactSearched = physicContactMap.find(b1->GetParentNode()->GetName() + "|" + b0->GetParentNode()->GetName());
769 physicContactMap.insert(PhysicContactMap::value_type(b0->GetParentNode()->GetName() + "|" + b1->GetParentNode()->GetName(), coll));
793 if (NewtonCollisionPointDistance(newtonWorld, &data->position.x, collision, &matrix[0][0], &contact.x, &normal.x, 0))
816 NewtonWorldForEachBodyInAABBDo(world->getNewtonWorld(), &vmin.x, &vmax.x, SPhysicWorld::ImpulsePointCallback, &data);
int getMaterialOverlapEndedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
Definition SCOLPhysics.cpp:266
SMaterialPair * getMaterialPairByWorld(SPhysicWorld *world, int ID1, int ID2)
function to check if a material ID exists
Definition SCOLPhysics.cpp:7714
int getMaterialOverlapStartedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
Definition SCOLPhysics.cpp:194
int getMaterialContactCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the callback a body leave the physic world.
Definition SCOLPhysics.cpp:106
int getMaterialOverlapEndedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
Definition SCOLPhysics.cpp:266
SMaterialPair * getMaterialPairByWorld(SPhysicWorld *world, int ID1, int ID2)
function to check if a material ID exists
Definition SCOLPhysics.cpp:7714
int getMaterialOverlapStartedCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the Physic Material Overlap callback.
Definition SCOLPhysics.cpp:194
int getMaterialContactCallback(mmachine m, SCOL_PTR_TYPE id, SCOL_PTR_TYPE param)
C function that prepares the VM for the execution of the callback a body leave the physic world.
Definition SCOLPhysics.cpp:106
simple class that represents a single raycast rigid body intersection.
Definition OgreNewt_RayCast.h:97
Ogre::Vector3 getNormal()
Definition OgreNewt_RayCast.h:105
OgreNewt::Body * getBody()
Definition OgreNewt_RayCast.h:103
Ogre::Real getDistance()
Definition OgreNewt_RayCast.h:102
BasicRaycastInfo getInfoAt(unsigned int hitnum) const
retrieve the raycast info for a specific hit.
Definition OgreNewt_RayCast.cpp:148
BasicRaycastInfo getFirstHit() const
get the closest body hit by the ray.
Definition OgreNewt_RayCast.cpp:126
const Ogre::Any & getUserData() const
retrieve pointer to previously set user data.
Definition OgreNewt_Body.h:118
void setMaterialGroupID(const MaterialID *ID)
set the material for the body
Definition OgreNewt_Body.h:312
const OgreNewt::MaterialID * getMaterialGroupID() const
get a pointer to the Material assigned to this body.
Definition OgreNewt_Body.cpp:399
Body * getNext() const
use this function to iterate through all bodies
Definition OgreNewt_Body.cpp:741
NewtonBody * getNewtonBody() const
get a pointer to the NewtonBody object
Definition OgreNewt_Body.h:127
void startRaycastRecording(bool markhitbodies=false)
enable additional raycast-debugging (this also enables displaying of recorded raycasts!...
Definition OgreNewt_Debugger.cpp:318
void setPreListener(std::string name, void *const listenerUserData, NewtonWorldUpdateListenerCallback update)
Definition OgreNewt_World.cpp:95
const MaterialID * getDefaultMaterialID() const
get the default materialID object.
Definition OgreNewt_World.h:291
void setpostListener(std::string name, void *const listenerUserData, NewtonWorldUpdateListenerCallback update)
Definition OgreNewt_World.cpp:100
int update(Ogre::Real t_step)
update the world by the specified time_step.
Definition OgreNewt_World.cpp:135
void setThreadCount(int threads)
set the number of threads for the physics simulation to use, don't do this while world update
Definition OgreNewt_World.cpp:129
NewtonWorld * getNewtonWorld() const
retrieves a pointer to the NewtonWorld
Definition OgreNewt_World.h:284
void setUpdateFPS(Ogre::Real desiredFps, int maxUpdatesPerFrames)
set simulation frames per and max updated per updates
Definition OgreNewt_World.cpp:105
Body * getFirstBody() const
to iterate through all bodies call this function and then use body->getNext()
Definition OgreNewt_World.cpp:191
void waitForUpdateToFinish() const
Definition OgreNewt_World.h:361
int getPlatformArchitecture(Ogre::String &description)
get the architecture used for physics calculations.
Definition OgreNewt_World.h:332
Definition SO3Body.h:43
OgreNewt::Body * getOgreNewtBodyPointer()
Definition SO3Body.cpp:340
Definition SO3MaterialID.h:45
Definition SO3MaterialPair.h:43
bool GetOverlapStartedCallbackActivated()
Definition SO3MaterialPair.cpp:63
bool GetOverlapEndedCallbackActivated()
Definition SO3MaterialPair.cpp:73
bool GetContactCallbackActivated()
Definition SO3MaterialPair.cpp:53
Definition SO3NodeScol.h:43
Definition SO3PhysicContraint.h:42
SMaterialPair * CreatePhysicMaterialPair(SMaterialID *mat1, SMaterialID *mat2)
Definition SO3Physics.cpp:574
static void PostUpdate(const NewtonWorld *const world, void *const listenerUserData, dFloat timestep)
Definition SO3Physics.cpp:112
SMaterialPairMap listOfPhysicsMaterialPair
Definition SO3Physics.h:103
static int ImpulsePointCallback(const NewtonBody *const body, void *const userData)
Definition SO3Physics.cpp:773
void SetPhysicWorldSize(const Ogre::Vector3 &minsize, const Ogre::Vector3 &maxsize)
Definition SO3Physics.cpp:517
void LeaveWorldCallBack(OgreNewt::Body *, int threadIndex)
Definition SO3Physics.cpp:590
static void PreUpdate(const NewtonWorld *const world, void *const listenerUserData, dFloat timestep)
Definition SO3Physics.cpp:103
void AddBodyPair(std::string name, SBody **pair)
Definition SO3Physics.cpp:624
void SetPhysicDebugEnable(const bool &enable)
Definition SO3Physics.cpp:153
void UpdatePhysic(const float &frameTime)
Definition SO3Physics.cpp:186
void AddPhysicContraint(SPhysicContraint *contraint)
Definition SO3Physics.cpp:670
SMaterialID * CreatePhysicMaterialID(const std::string &materialIdName)
Definition SO3Physics.cpp:530
void ClearContactOverlapStart()
Definition SO3Physics.cpp:717
void SetPhysicPlatformArchitecture(const int &mod)
Definition SO3Physics.cpp:421
void SetPhysicSolverModel(const int &mod)
Definition SO3Physics.cpp:410
void GetPhysicWorldSize(Ogre::Vector3 &minsize, Ogre::Vector3 &maxsize)
Definition SO3Physics.cpp:523
void SetContactActivated(SBody *b0, SBody *b1, MCOLL *coll)
Definition SO3Physics.cpp:755
bool GetBodyPairExist(SBody *b0, SBody *b1)
Definition SO3Physics.cpp:611
void SetPhysicWorldEnable(const bool &enable)
Definition SO3Physics.cpp:127
void SetResetPhysicWorld(const bool &state)
Definition SO3Physics.cpp:464
void ApplyImpulsePoint(Ogre::Vector3 pos, Ogre::Real radius, Ogre::Real strength)
Definition SO3Physics.cpp:805
void RemovePhysicContraint(SPhysicContraint *contraint)
Definition SO3Physics.cpp:675
OgreNewt::Debugger * GetPhysicDebugger()
Definition SO3Physics.cpp:181
PhysicContraintList GetPhysicContraintList()
Definition SO3Physics.cpp:681
int GetPhysicPlatformArchitecture()
Definition SO3Physics.cpp:426
void SetPhysicBodiesInitialState()
Definition SO3Physics.cpp:394
SBody * PhysicsRayCast(const Ogre::Vector3 &src, const Ogre::Vector3 &dir, const Ogre::Real &maxdist, Ogre::Real &hitdistance, Ogre::Vector3 &hitnormal)
Definition SO3Physics.cpp:469
void RemoveBodyContraint(SBody *body)
Definition SO3Physics.cpp:697
void SetPhysicGravity(const Ogre::Vector3 &gravity)
Definition SO3Physics.cpp:432
void AddContactOverlapStart(std::string name, MCOLL *coll)
Definition SO3Physics.cpp:733
void DeletePhysicMaterialID(SMaterialID *matID)
Definition SO3Physics.cpp:539
void DeletePhysicMaterialPair(SMaterialPair *matpair)
Definition SO3Physics.cpp:583
Definition SO3Scene.h:125
Definition SO3DataScol.h:38
std::unordered_set< SMaterialPair * > SMaterialPairMap
Definition SO3Prerequisites.h:272
std::set< SPhysicContraint * > PhysicContraintList
Definition SO3Physics.h:98
std::unordered_map< std::string, MCOLL * > PhysicContactMap
Definition SO3Physics.h:97
Definition SO3Physics.h:46
Definition SO3Physics.h:84
Definition SO3Physics.h:70
Generated by 1.9.8