SO3Engine
OgreNewt_Joint.h
Go to the documentation of this file.
1/*
2 OgreNewt Library
3
4 Ogre implementation of Newton Game Dynamics SDK
5
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.
7
8 by Walaber
9 some changes by melven
10
11*/
12#ifndef _INCLUDE_OGRENEWT_JOINT
13#define _INCLUDE_OGRENEWT_JOINT
14
15
16
18
19class CustomJoint;
20
21// OgreNewt namespace. all functions and classes use this namespace.
22namespace OgreNewt
23{
24
26
29 //class _OgreNewtExport Joint : public _DestructorCallback<Joint>
30 class _OgreNewtExport Joint
31 {
32 public:
33
35 Joint();
36
38 virtual ~Joint();
39
41 Body* getBody0() const;
42
44 Body* getBody1() const;
45
47 const OgreNewt::World* getWorld();
48
50 virtual void submitConstraint( Ogre::Real timeStep, int threadIndex ) {};
51
53
57 virtual void showDebugData(Ogre::SceneNode* debugRootNode) {}
58
60
64 int getCollisionState() const;
65
67
71 void setCollisionState( int state ) const;
72
74
78 Ogre::Real getStiffness() const;
79
81
85 void setStiffness( Ogre::Real stiffness ) const;
86
87 protected:
93 void addLinearRow( const Ogre::Vector3& pt0, const Ogre::Vector3& pt1, const Ogre::Vector3& dir ) const;
94
96 void addAngularRow( Ogre::Radian relativeAngleError, const Ogre::Vector3& dir ) const;
97
99 void addGeneralRow(const Ogre::Vector3& linear0, const Ogre::Vector3& angular0, const Ogre::Vector3& linear1, const Ogre::Vector3& angular1) const;
100
102 void setRowMinimumFriction( Ogre::Real friction ) const;
103
105 void setRowMaximumFriction( Ogre::Real friction ) const;
106
108 void setRowStiffness( Ogre::Real stiffness ) const;
109
111 void setRowAcceleration( Ogre::Real accel ) const;
112
114 void setRowSpringDamper(Ogre::Real springK, Ogre::Real springD) const;
115
116 protected:
117
119 static void _CDECL destructorCallback (const CustomJoint* me);
120
121 // ! submitConstraint callback glue
122 static void _CDECL submitConstraintCallback ( const CustomJoint* me, dFloat timestep, int threadIndex );
123
125 void SetSupportJoint (CustomJoint* supportJoint);
126
128 CustomJoint* GetSupportJoint () const;
129
130 CustomJoint* m_joint;
131 };
132
133 class _OgreNewtExport OgCustomJoint : public Joint
134 {
135 public:
136 OgCustomJoint( unsigned int maxDOF, const OgreNewt::Body* child, const OgreNewt::Body* parent);
137 virtual ~OgCustomJoint();
138
139 void pinAndDirToLocal( const Ogre::Vector3& pinpt, const Ogre::Vector3& pindir, Ogre::Quaternion& localOrient0, Ogre::Vector3& localPos0, Ogre::Quaternion& localOrient1, Ogre::Vector3& localPos1 ) const;
140 void localToGlobal( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex ) const;
141 void localToGlobalVisual( const Ogre::Quaternion& localOrient, const Ogre::Vector3& localPos, Ogre::Quaternion& globalOrient, Ogre::Vector3& globalPos, int bodyIndex ) const;
142 void globalToLocal( const Ogre::Quaternion& globalOrient, const Ogre::Vector3& globalPos, Ogre::Quaternion& localOrient, Ogre::Vector3& localPos, int bodyIndex ) const;
143 Ogre::Quaternion grammSchmidt( const Ogre::Vector3& pin ) const;
144
145 protected:
146 unsigned int m_maxDOF;
147
150 };
151
152} // end NAMESPACE OgreNewt
153
154
155
156
157// _INCLUDE_OGRENEWT_JOINT
158
159#endif
main class for all Rigid Bodies in the system.
base class for all joints.
virtual void showDebugData(Ogre::SceneNode *debugRootNode)
show joint visual debugging data
virtual void submitConstraint(Ogre::Real timeStep, int threadIndex)
must be define for a functioning joint.
CustomJoint * m_joint
const OgreNewt::Body * m_body0
const OgreNewt::Body * m_body1
represents a physics world.