SO3Engine
SO3PhysicContraint.cpp
Go to the documentation of this file.
1
11
12namespace SO3
13{
14
15SPhysicContraint::SPhysicContraint()
16{
17 // Forbiden, private.
18}
19
20SPhysicContraint::SPhysicContraint(SScene* scene, SBody* son, SBody* parent, PhysicContraintType type)
21{
22 mScene = scene;
23 mParentBody = parent;
24 mSonBody = son;
25 mType = type;
26
27 mJoint = 0;
28}
29
38
43
48
50{
51 mParentBody = body;
52}
53
55{
56 mSonBody = body;
57}
58
63
68
70{
71 if(mJoint)
72 mJoint->setCollisionState(state ? 1 : 0);
73}
74
76{
77 if(mJoint)
78 return mJoint->getCollisionState() == 1 ? true : false;
79 else
80 return false;
81}
82
84{
85 if(mJoint)
86 return mJoint->getStiffness();
87 else
88 return 0.0f;
89}
90
91void SPhysicContraint::SetStiffness(Ogre::Real value)
92{
93 if (value < 0.0f)
94 value = 0.0f;
95 else if (value > 1.0f)
96 value = 1.0f;
97
98 if(mJoint)
99 mJoint->setStiffness(value);
100}
101
102}
librairies include
void setStiffness(Ogre::Real stiffness) const
set joint stiffness
int getCollisionState() const
returns collision state
void setCollisionState(int state) const
sets the collision state
Ogre::Real getStiffness() const
get joint stiffness
void waitForUpdateToFinish() const
void SetCollisionState(bool state)
OgreNewt::Joint * mJoint
virtual void SetSonBody(SBody *body)=0
PhysicContraintType mType
void SetStiffness(Ogre::Real value)
PhysicContraintType GetType()
virtual void SetParentBody(SBody *body)=0
OgreNewt::World * GetPhysicWorld()
SPhysicWorld * GetPhysicsWorld()