SO3Engine
|
SO3Body.cpp
Go to the documentation of this file.
54 O3Body = new OgreNewt::Body(mScene->GetPhysicsWorld()->GetPhysicWorld(), mShape->GetOgreNewtCollisionPtr());
215 if (!HasBuoyancy && (mApplyGravity && mNode != 0) && (mNode->GetParentScene() != 0) && (mass != 0.0))
217 Ogre::Vector3 gravityForce = mNode->GetParentScene()->GetPhysicsWorld()->GetPhysicGravity() * mass;
224 for (std::vector<std::pair<Ogre::Vector3, Ogre::Vector3> >::const_iterator it = body->m_accumulatedGlobalForces.begin(); it != body->m_accumulatedGlobalForces.end(); it++)
226 //Ogre::LogManager::getSingleton().getDefaultLog()->logMessage("# [" + Ogre::StringConverter::toString(++nth) + "] force " + Ogre::StringConverter::toString(it->first) + " at " + Ogre::StringConverter::toString(it->second) + " to " + body->getOgreNode()->getName());
253 if (body->isFreezed() && (haveToMove || haveToRotate || ((O3Body->getVelocity().length() > 0.0f) && (O3Body->getOmega().length() > 0.0f) && (O3Body->getForce().length() > 0.0f) && (O3Body->getForceAcceleration().length() > 0.0f))))
314 dFloat fluidDentity = std::max((mass / shapeVolume) * mFluidWaterToVolume, std::min((mass / shapeVolume) / (1.0f - mFluidWaterToVolume), mass / (mFluidWaterToVolume * shapeVolume * ((mass * 0.01f) / shapeVolume))));
315 //dFloat fluidDentity = mass / (mFluidWaterToVolume * shapeVolume * ((mass * 0.01f) / shapeVolume));
319 NewtonConvexCollisionCalculateBuoyancyAcceleration(collision, &matrix[0][0], &cog[0], &gravity.x, &plane[0], fluidDentity, mFluidViscosity, &accelPerUnitMass[0], &torquePerUnitMass[0]);
360 O3Body = new OgreNewt::Body(mScene->GetPhysicsWorld()->GetPhysicWorld(), mShape->GetOgreNewtCollisionPtr(), 0, state);
380 O3Body->setMaterialGroupID(mScene->GetPhysicsWorld()->GetPhysicWorld()->getDefaultMaterialID());
592 void SBody::SetPositionOrientation(const Ogre::Vector3& mDerivedPos, const Ogre::Quaternion& mDerivedOrientation)
604 void SBody::UpdatePositionOrientation(const Ogre::Vector3& mDerivedPos, const Ogre::Quaternion& mDerivedOrientation)
622 void SBody::SetMatrix(const Ogre::Vector3& mDerivedPos, const Ogre::Quaternion& mDerivedOrientation)
794 Ogre::Vector3 invscale = Ogre::Vector3::UNIT_SCALE / lines->getParentNode()->_getDerivedScale();
799 p0 = Ogre::Vector3(faceVertec[(i * 3) + 0], faceVertec[(i * 3) + 1], faceVertec[(i * 3) + 2]) * invscale;
803 p1 = Ogre::Vector3(faceVertec[(i * 3) + 0], faceVertec[(i * 3) + 1], faceVertec[(i * 3) + 2]) * invscale;
847 OgreNewt::Converters::QuatPosToMatrix(Ogre::Quaternion::IDENTITY, Ogre::Vector3::ZERO, &matrix[0]);
849 NewtonCollisionForEachPolygonDo(NewtonBodyGetCollision(O3Body->getNewtonBody()), &matrix[0], newtonPerPoly, mDebugBody);
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
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 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 getInvMass(Ogre::Real &mass, Ogre::Vector3 &inertia) const
get invert mass + inertia for the body.
Definition OgreNewt_Body.cpp:521
void addLocalForce(const Ogre::Vector3 &force, const Ogre::Vector3 &pos)
Definition OgreNewt_Body.cpp:728
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
const OgreNewt::MaterialID * getMaterialGroupID() const
get a pointer to the Material assigned to this body.
Definition OgreNewt_Body.cpp:399
int getAutoSleep()
get whether the body should "sleep" when equilibrium is reached.
Definition OgreNewt_Body.h:378
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
void setMassMatrix(Ogre::Real mass, const Ogre::Vector3 &inertia)
set the mass and inertia for the body.
Definition OgreNewt_Body.cpp:314
Ogre::Vector3 getOmega() const
get omega of the body. in global space.
Definition OgreNewt_Body.cpp:533
void setPositionOrientationFromNode(int threadIndex=-1)
position and orient the body from node.
Definition OgreNewt_Body.cpp:291
Ogre::Vector3 calculateOffset() const
Definition OgreNewt_Body.cpp:671
NewtonBody * getNewtonBody() const
get a pointer to the NewtonBody object
Definition OgreNewt_Body.h:127
void setPositionOrientation(const Ogre::Vector3 &pos, const Ogre::Quaternion &orient, int threadIndex=-1)
position and orient the body arbitrarily.
Definition OgreNewt_Body.cpp:248
Ogre::Vector3 getForceAcceleration() const
get the linear acceleration due to forces acting on the body.
Definition OgreNewt_Body.cpp:593
int getContinuousCollisionMode() const
returns current setting for this body.
Definition OgreNewt_Body.h:415
void setNodeUpdateNotify(NodeUpdateNotifyCallback callback)
set a custom node update notify.
Definition OgreNewt_Body.cpp:750
void setOmega(const Ogre::Vector3 &omega)
set an arbitrary omega for the body.
Definition OgreNewt_Body.h:335
void setVelocity(const Ogre::Vector3 &vel)
set an arbitrary velocity for the body.
Definition OgreNewt_Body.cpp:807
void setLinearDamping(Ogre::Real damp)
set the linear damping for the body.
Definition OgreNewt_Body.h:352
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 setTriggerInsideCallback(TriggerInsideCallback callback)
Definition OgreNewt_Body.cpp:357
void setAutoSleep(int flag)
set whether the body should "sleep" when equilibruim is reached.
Definition OgreNewt_Body.h:375
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
void setCenterOfMass(const Ogre::Vector3 ¢erOfMass)
set the body's center of mass
Definition OgreNewt_Body.h:271
const MaterialID * getDefaultMaterialID() const
get the default materialID object.
Definition OgreNewt_World.h:291
void waitForUpdateToFinish() const
Definition OgreNewt_World.h:361
Definition SO3Body.h:43
void AddImpulse(const Ogre::Vector3 &delta, const Ogre::Vector3 &pos)
Definition SO3Body.cpp:644
void SetAngularDamping(const Ogre::Vector3 &vec)
Definition SO3Body.cpp:665
void AddConstantForce(const Ogre::Vector3 &mForce)
Definition SO3Body.cpp:552
void SetPositionOrientation(const Ogre::Vector3 &mDerivedPos, const Ogre::Quaternion &mDerivedOrientation)
Definition SO3Body.cpp:592
void SetConstantTorque(const Ogre::Vector3 &mTorque)
Definition SO3Body.cpp:547
void SetContinuousCollisionMode(const bool &enable)
Definition SO3Body.cpp:718
void SetGlobalForce(const Ogre::Vector3 &mGlobalForce)
Definition SO3Body.cpp:577
OgreNewt::Body * getOgreNewtBodyPointer()
Definition SO3Body.cpp:340
void AddConstantTorque(const Ogre::Vector3 &mTorque)
Definition SO3Body.cpp:557
void GetMassMatrix(Ogre::Real &mass, Ogre::Vector3 &inertia)
Definition SO3Body.cpp:734
void SetConstantForce(const Ogre::Vector3 &mForce)
Definition SO3Body.cpp:542
void MoveToPosition(const Ogre::Vector3 &destPos, const Ogre::Real &stiffness)
Definition SO3Body.cpp:739
void SetLocalForce(const Ogre::Vector3 &mLocalForce)
Definition SO3Body.cpp:572
void SetMatrix(const Ogre::Vector3 &mDerivedPos, const Ogre::Quaternion &mDerivedOrientation)
Definition SO3Body.cpp:622
void GetPositionOrientation(Ogre::Vector3 &pos, Ogre::Quaternion &orient)
Definition SO3Body.cpp:761
void GetInvMass(Ogre::Real &mass, Ogre::Vector3 &inertia)
Definition SO3Body.cpp:729
void BodyUpdateCallback(OgreNewt::Body *body)
Definition SO3Body.cpp:166
void BodyAddForceCallback(OgreNewt::Body *body, float timeStep, int threadIndex)
Definition SO3Body.cpp:208
void SetFluidVolumeRatio(float waterToVolume)
Definition SO3Body.cpp:403
void SetGlobalLocationForce(const Ogre::Vector3 &mGlobalLocationForce)
Definition SO3Body.cpp:582
void RotateToOrientation(const Ogre::Quaternion &destQuat, const Ogre::Real &stiffness)
Definition SO3Body.cpp:747
void SetMassMatrix(const Ogre::Real &mass, const Ogre::Vector3 &inertial)
Definition SO3Body.cpp:479
void SetLocalLocationForce(const Ogre::Vector3 &mLocalLocationForce)
Definition SO3Body.cpp:587
Definition SO3Bone.h:42
void AttachToBone(Ogre::MovableObject *ogreObject)
Definition SO3Bone.cpp:538
void DetachFromBone(Ogre::MovableObject *ogreObject)
Definition SO3Bone.cpp:550
Definition SO3Entity.h:43
Definition SO3MaterialID.h:45
OgreNewt::MaterialID * getOgreNewtMaterialID()
Definition SO3MaterialID.cpp:32
Definition SO3NodeScol.h:43
virtual Ogre::Quaternion GetGlobalOrientation()
Definition SO3NodeScol.cpp:709
virtual void SetGlobalPosition(const Ogre::Vector3 &pos, bool updateBody=true)
Definition SO3NodeScol.cpp:660
virtual void SetGlobalOrientation(const Ogre::Quaternion &quat, bool updateBody=true)
Definition SO3NodeScol.cpp:723
virtual Ogre::Vector3 GetGlobalPosition()
Definition SO3NodeScol.cpp:649
Ogre::SceneNode * GetOgreSceneNodePointer()
Definition SO3NodeScol.cpp:163
void RemoveBodyContraint(SBody *body)
Definition SO3Physics.cpp:697
Definition SO3Shape.h:47
OgreNewt::CollisionPtr GetOgreNewtCollisionPtr()
Definition SO3Shape.cpp:59
Definition SO3Skeleton.h:42
_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
Definition SO3DataScol.h:38
Generated by 1.9.8