Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / gameengine / Physics / Bullet / CcdPhysicsController.h
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose, 
8 including commercial applications, and to alter it and redistribute it freely, 
9 subject to the following restrictions:
10
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15
16
17 #ifndef BULLET2_PHYSICSCONTROLLER_H
18 #define BULLET2_PHYSICSCONTROLLER_H
19
20 #include <vector>
21 #include <map>
22
23 #include "PHY_IPhysicsController.h"
24
25 ///     PHY_IPhysicsController is the abstract simplified Interface to a physical object.
26 ///     It contains the IMotionState and IDeformableMesh Interfaces.
27 #include "btBulletDynamicsCommon.h"
28 #include "LinearMath/btTransform.h"
29
30 #include "PHY_IMotionState.h"
31
32 extern float gDeactivationTime;
33 extern float gLinearSleepingTreshold;
34 extern float gAngularSleepingTreshold;
35 extern bool gDisableDeactivation;
36 class CcdPhysicsEnvironment;
37 class btMotionState;
38 class RAS_MeshObject;
39 struct DerivedMesh;
40 class btCollisionShape;
41
42
43 #define CCD_BSB_SHAPE_MATCHING  2
44 #define CCD_BSB_BENDING_CONSTRAINTS 8
45 #define CCD_BSB_AERO_VPOINT 16 /* aero model, Vertex normals are oriented toward velocity*/
46 #define CCD_BSB_AERO_VTWOSIDE 32 /* aero model, Vertex normals are flipped to match velocity */
47
48 /* BulletSoftBody.collisionflags */
49 #define CCD_BSB_COL_SDF_RS      2 /* SDF based rigid vs soft */
50 #define CCD_BSB_COL_CL_RS       4 /* Cluster based rigid vs soft */
51 #define CCD_BSB_COL_CL_SS       8 /* Cluster based soft vs soft */
52 #define CCD_BSB_COL_VF_SS       16 /* Vertex/Face based soft vs soft */
53
54
55
56 // Shape contructor
57 // It contains all the information needed to create a simple bullet shape at runtime
58 class CcdShapeConstructionInfo
59 {
60 public:
61         static CcdShapeConstructionInfo* FindMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope, bool gimpact);
62
63         CcdShapeConstructionInfo() :
64                 m_shapeType(PHY_SHAPE_NONE),
65                 m_radius(1.0),
66                 m_height(1.0),
67                 m_halfExtend(0.f,0.f,0.f),
68                 m_childScale(1.0f,1.0f,1.0f),
69                 m_userData(NULL),
70                 m_refCount(1),
71                 m_meshObject(NULL),
72                 m_unscaledShape(NULL),
73                 m_useGimpact(false),
74                 m_weldingThreshold1(0.f),
75                 m_shapeProxy(NULL)
76         {
77                 m_childTrans.setIdentity();
78         }
79
80         ~CcdShapeConstructionInfo();
81
82         CcdShapeConstructionInfo* AddRef()
83         { 
84                 m_refCount++;
85                 return this;
86         }
87
88         int Release()
89         {
90                 if (--m_refCount > 0)
91                         return m_refCount;
92                 delete this;
93                 return 0;
94         }
95
96         bool IsUnused(void)
97         {
98                 return (m_meshObject==NULL && m_shapeArray.size() == 0 && m_shapeProxy == NULL);
99         }
100
101         void AddShape(CcdShapeConstructionInfo* shapeInfo);
102
103         btTriangleMeshShape* GetMeshShape(void)
104         {
105                 return m_unscaledShape;
106         }
107         CcdShapeConstructionInfo* GetChildShape(int i)
108         {
109                 if (i < 0 || i >= (int)m_shapeArray.size())
110                         return NULL;
111
112                 return m_shapeArray.at(i);
113         }
114         int FindChildShape(CcdShapeConstructionInfo* shapeInfo, void* userData)
115         {
116                 if (shapeInfo == NULL)
117                         return -1;
118                 for (int i=0; i<(int)m_shapeArray.size(); i++)
119                 {
120                         CcdShapeConstructionInfo* childInfo = m_shapeArray.at(i);
121                         if ((userData == NULL || userData == childInfo->m_userData) &&
122                                 (childInfo == shapeInfo ||
123                                  (childInfo->m_shapeType == PHY_SHAPE_PROXY && 
124                                   childInfo->m_shapeProxy == shapeInfo)))
125                                 return i;
126                 }
127                 return -1;
128         }
129
130         bool RemoveChildShape(int i)
131         {
132                 if (i < 0 || i >= (int)m_shapeArray.size())
133                         return false;
134                 m_shapeArray.at(i)->Release();
135                 if (i < (int)m_shapeArray.size()-1)
136                         m_shapeArray[i] = m_shapeArray.back();
137                 m_shapeArray.pop_back();
138                 return true;
139         }
140
141         bool SetMesh(class RAS_MeshObject* mesh, struct DerivedMesh* dm, bool polytope,bool useGimpact);
142         RAS_MeshObject* GetMesh(void)
143         {
144                 return m_meshObject;
145         }
146
147         bool UpdateMesh(class KX_GameObject* gameobj, class RAS_MeshObject* mesh);
148
149
150         bool SetProxy(CcdShapeConstructionInfo* shapeInfo);
151         CcdShapeConstructionInfo* GetProxy(void)
152         {
153                 return m_shapeProxy;
154         }
155
156         btCollisionShape* CreateBulletShape(btScalar margin);
157
158         // member variables
159         PHY_ShapeType                   m_shapeType;
160         btScalar                                m_radius;
161         btScalar                                m_height;
162         btVector3                               m_halfExtend;
163         btTransform                             m_childTrans;
164         btVector3                               m_childScale;
165         void*                                   m_userData;     
166         btAlignedObjectArray<btScalar>  m_vertexArray;  // Contains both vertex array for polytope shape and
167                                                                                         // triangle array for concave mesh shape. Each vertex is 3 consecutive values
168                                                                                         // In this case a triangle is made of 3 consecutive points
169         std::vector<int>                m_polygonIndexArray;    // Contains the array of polygon index in the 
170                                                                                                         // original mesh that correspond to shape triangles.
171                                                                                                         // only set for concave mesh shape.
172         
173         std::vector<int>                m_triFaceArray; // Contains an array of triplets of face indicies
174                                                                                         // quads turn into 2 tris
175
176         void    setVertexWeldingThreshold1(float threshold)
177         {
178                 m_weldingThreshold1  = threshold*threshold;
179         }
180 protected:
181         static std::map<RAS_MeshObject*, CcdShapeConstructionInfo*> m_meshShapeMap;
182         int                                             m_refCount;             // this class is shared between replicas
183                                                                                         // keep track of users so that we can release it 
184         RAS_MeshObject* m_meshObject;                   // Keep a pointer to the original mesh 
185         btBvhTriangleMeshShape* m_unscaledShape;// holds the shared unscale BVH mesh shape, 
186                                                                                         // the actual shape is of type btScaledBvhTriangleMeshShape
187         std::vector<CcdShapeConstructionInfo*> m_shapeArray;    // for compound shapes
188         bool    m_useGimpact; //use gimpact for concave dynamic/moving collision detection
189         bool    m_forceReInstance; //use gimpact for concave dynamic/moving collision detection
190         float   m_weldingThreshold1;    //welding closeby vertices together can improve softbody stability etc.
191         CcdShapeConstructionInfo* m_shapeProxy; // only used for PHY_SHAPE_PROXY, pointer to actual shape info
192
193
194 #ifdef WITH_CXX_GUARDEDALLOC
195 public:
196         void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdShapeConstructionInfo"); }
197         void operator delete( void *mem ) { MEM_freeN(mem); }
198 #endif
199 };
200
201 struct CcdConstructionInfo
202 {
203
204         ///CollisionFilterGroups provides some optional usage of basic collision filtering
205         ///this is done during broadphase, so very early in the pipeline
206         ///more advanced collision filtering should be done in btCollisionDispatcher::NeedsCollision
207         enum CollisionFilterGroups
208         {
209                 DefaultFilter = 1,
210                 StaticFilter = 2,
211                 KinematicFilter = 4,
212                 DebrisFilter = 8,
213                         SensorFilter = 16,
214                 AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter,
215         };
216
217
218         CcdConstructionInfo()
219                 : m_localInertiaTensor(1.f, 1.f, 1.f),
220                 m_gravity(0,0,0),
221                 m_scaling(1.f,1.f,1.f),
222                 m_mass(0.f),
223                 m_clamp_vel_min(-1.f), 
224                 m_clamp_vel_max(-1.f), 
225                 m_restitution(0.1f),
226                 m_friction(0.5f),
227                 m_linearDamping(0.1f),
228                 m_angularDamping(0.1f),
229                 m_margin(0.06f),
230                 m_gamesoftFlag(0),
231                 m_collisionFlags(0),
232                 m_bRigid(false),
233                 m_bSoft(false),
234                 m_bSensor(false),
235                 m_collisionFilterGroup(DefaultFilter),
236                 m_collisionFilterMask(AllFilter),
237                 m_collisionShape(0),
238                 m_MotionState(0),
239                 m_shapeInfo(0),
240                 m_physicsEnv(0),
241                 m_inertiaFactor(1.f),
242                 m_do_anisotropic(false),
243                 m_anisotropicFriction(1.f,1.f,1.f),
244                 m_contactProcessingThreshold(1e10)
245         {
246         }
247
248         btVector3       m_localInertiaTensor;
249         btVector3       m_gravity;
250         btVector3       m_scaling;
251         btScalar        m_mass;
252         btScalar        m_clamp_vel_min;  
253         btScalar        m_clamp_vel_max;  
254         btScalar        m_restitution;
255         btScalar        m_friction;
256         btScalar        m_linearDamping;
257         btScalar        m_angularDamping;
258         btScalar        m_margin;
259
260         ////////////////////
261         int             m_gamesoftFlag;
262         float   m_soft_linStiff;                        /* linear stiffness 0..1 */
263         float   m_soft_angStiff;                /* angular stiffness 0..1 */
264         float   m_soft_volume;                  /* volume preservation 0..1 */
265
266         int             m_soft_viterations;             /* Velocities solver iterations */
267         int             m_soft_piterations;             /* Positions solver iterations */
268         int             m_soft_diterations;             /* Drift solver iterations */
269         int             m_soft_citerations;             /* Cluster solver iterations */
270
271         float   m_soft_kSRHR_CL;                /* Soft vs rigid hardness [0,1] (cluster only) */
272         float   m_soft_kSKHR_CL;                /* Soft vs kinetic hardness [0,1] (cluster only) */
273         float   m_soft_kSSHR_CL;                /* Soft vs soft hardness [0,1] (cluster only) */
274         float   m_soft_kSR_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
275
276         float   m_soft_kSK_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
277         float   m_soft_kSS_SPLT_CL;     /* Soft vs rigid impulse split [0,1] (cluster only) */
278         float   m_soft_kVCF;                    /* Velocities correction factor (Baumgarte) */
279         float   m_soft_kDP;                     /* Damping coefficient [0,1] */
280
281         float   m_soft_kDG;                     /* Drag coefficient [0,+inf] */
282         float   m_soft_kLF;                     /* Lift coefficient [0,+inf] */
283         float   m_soft_kPR;                     /* Pressure coefficient [-inf,+inf] */
284         float   m_soft_kVC;                     /* Volume conversation coefficient [0,+inf] */
285
286         float   m_soft_kDF;                     /* Dynamic friction coefficient [0,1] */
287         float   m_soft_kMT;                     /* Pose matching coefficient [0,1] */
288         float   m_soft_kCHR;                    /* Rigid contacts hardness [0,1] */
289         float   m_soft_kKHR;                    /* Kinetic contacts hardness [0,1] */
290
291         float   m_soft_kSHR;                    /* Soft contacts hardness [0,1] */
292         float   m_soft_kAHR;                    /* Anchors hardness [0,1] */
293         int             m_soft_collisionflags;  /* Vertex/Face or Signed Distance Field(SDF) or Clusters, Soft versus Soft or Rigid */
294         int             m_soft_numclusteriterations;    /* number of iterations to refine collision clusters*/
295 ///////////////////
296
297
298
299         int                     m_collisionFlags;
300         bool            m_bRigid;
301         bool            m_bSoft;
302         bool            m_bSensor;
303
304         ///optional use of collision group/mask:
305         ///only collision with object goups that match the collision mask.
306         ///this is very basic early out. advanced collision filtering should be
307         ///done in the btCollisionDispatcher::NeedsCollision and NeedsResponse
308         ///both values default to 1
309         short int       m_collisionFilterGroup;
310         short int       m_collisionFilterMask;
311
312         ///these pointers are used as argument passing for the CcdPhysicsController constructor
313         ///and not anymore after that
314         class btCollisionShape* m_collisionShape;
315         class PHY_IMotionState* m_MotionState;
316         class CcdShapeConstructionInfo* m_shapeInfo;
317         
318         CcdPhysicsEnvironment*  m_physicsEnv; //needed for self-replication
319         float   m_inertiaFactor;//tweak the inertia (hooked up to Blender 'formfactor'
320         bool    m_do_anisotropic;
321         btVector3 m_anisotropicFriction;
322
323         bool            m_do_fh;                 ///< Should the object have a linear Fh spring?
324         bool            m_do_rot_fh;             ///< Should the object have an angular Fh spring?
325         btScalar        m_fh_spring;             ///< Spring constant (both linear and angular)
326         btScalar        m_fh_damping;            ///< Damping factor (linear and angular) in range [0, 1]
327         btScalar        m_fh_distance;           ///< The range above the surface where Fh is active.    
328         bool            m_fh_normal;             ///< Should the object slide off slopes?
329         float           m_radius;//for fh backwards compatibility
330         
331         ///m_contactProcessingThreshold allows to process contact points with positive distance
332         ///normally only contacts with negative distance (penetration) are solved
333         ///however, rigid body stacking is more stable when positive contacts are still passed into the constraint solver
334         ///this might sometimes lead to collisions with 'internal edges' such as a sliding character controller
335         ///so disable/set m_contactProcessingThreshold to zero for sliding characters etc.
336         float           m_contactProcessingThreshold;///< Process contacts with positive distance in range [0..INF]
337
338 };
339
340
341 class btRigidBody;
342 class btCollisionObject;
343 class btSoftBody;
344
345 ///CcdPhysicsController is a physics object that supports continuous collision detection and time of impact based physics resolution.
346 class CcdPhysicsController : public PHY_IPhysicsController      
347 {
348 protected:
349         btCollisionObject* m_object;
350         
351
352         class PHY_IMotionState*         m_MotionState;
353         btMotionState*  m_bulletMotionState;
354         class btCollisionShape* m_collisionShape;
355         class CcdShapeConstructionInfo* m_shapeInfo;
356
357         friend class CcdPhysicsEnvironment;     // needed when updating the controller
358
359         //some book keeping for replication
360         bool    m_softbodyMappingDone;
361         bool    m_softBodyTransformInitialized;
362         bool    m_prototypeTransformInitialized;
363         btTransform     m_softbodyStartTrans;
364
365
366         void*           m_newClientInfo;
367         int                     m_registerCount;        // needed when multiple sensors use the same controller
368         CcdConstructionInfo     m_cci;//needed for replication
369
370         CcdPhysicsController* m_parentCtrl;
371
372         void GetWorldOrientation(btMatrix3x3& mat);
373
374         void CreateRigidbody();
375
376         bool Register() { 
377                 return (m_registerCount++ == 0) ? true : false;
378         }
379         bool Unregister() {
380                 return (--m_registerCount == 0) ? true : false;
381         }
382
383         void setWorldOrientation(const btMatrix3x3& mat);
384         void forceWorldTransform(const btMatrix3x3& mat, const btVector3& pos);
385
386         public:
387         
388                 int                             m_collisionDelay;
389         
390
391                 CcdPhysicsController (const CcdConstructionInfo& ci);
392
393                 bool DeleteControllerShape();
394                 bool ReplaceControllerShape(btCollisionShape *newShape);
395
396                 virtual ~CcdPhysicsController();
397
398                 CcdConstructionInfo& getConstructionInfo()
399                 {
400                         return m_cci;
401                 }
402                 const CcdConstructionInfo& getConstructionInfo() const
403                 {
404                         return m_cci;
405                 }
406
407
408                 btRigidBody* GetRigidBody();
409                 btCollisionObject*      GetCollisionObject();
410                 btSoftBody* GetSoftBody();
411
412                 CcdShapeConstructionInfo* GetShapeInfo() { return m_shapeInfo; }
413
414                 btCollisionShape*       GetCollisionShape() { 
415                         return m_object->getCollisionShape();
416                 }
417                 ////////////////////////////////////
418                 // PHY_IPhysicsController interface
419                 ////////////////////////////////////
420
421
422                 /**
423                         SynchronizeMotionStates ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
424                 */
425                 virtual bool            SynchronizeMotionStates(float time);
426                 /**
427                         WriteMotionStateToDynamics ynchronizes dynas, kinematic and deformable entities (and do 'late binding')
428                 */
429                 
430                 virtual void            WriteMotionStateToDynamics(bool nondynaonly);
431                 virtual void            WriteDynamicsToMotionState();
432
433                 // controller replication
434                 virtual void            PostProcessReplica(class PHY_IMotionState* motionstate,class PHY_IPhysicsController* parentctrl);
435
436                 // kinematic methods
437                 virtual void            RelativeTranslate(float dlocX,float dlocY,float dlocZ,bool local);
438                 virtual void            RelativeRotate(const float drot[9],bool local);
439                 virtual void            getOrientation(float &quatImag0,float &quatImag1,float &quatImag2,float &quatReal);
440                 virtual void            setOrientation(float quatImag0,float quatImag1,float quatImag2,float quatReal);
441                 virtual void            setPosition(float posX,float posY,float posZ);
442                 virtual void            getPosition(PHY__Vector3&       pos) const;
443
444                 virtual void            setScaling(float scaleX,float scaleY,float scaleZ);
445                 
446                 // physics methods
447                 virtual void            ApplyTorque(float torqueX,float torqueY,float torqueZ,bool local);
448                 virtual void            ApplyForce(float forceX,float forceY,float forceZ,bool local);
449                 virtual void            SetAngularVelocity(float ang_velX,float ang_velY,float ang_velZ,bool local);
450                 virtual void            SetLinearVelocity(float lin_velX,float lin_velY,float lin_velZ,bool local);
451                 virtual void            applyImpulse(float attachX,float attachY,float attachZ, float impulseX,float impulseY,float impulseZ);
452                 virtual void            SetActive(bool active);
453
454                 // reading out information from physics
455                 virtual void            GetLinearVelocity(float& linvX,float& linvY,float& linvZ);
456                 virtual void            GetAngularVelocity(float& angVelX,float& angVelY,float& angVelZ);
457                 virtual void            GetVelocity(const float posX,const float posY,const float posZ,float& linvX,float& linvY,float& linvZ); 
458                 virtual void            getReactionForce(float& forceX,float& forceY,float& forceZ);
459
460                 // dyna's that are rigidbody are free in orientation, dyna's with non-rigidbody are restricted 
461                 virtual void            setRigidBody(bool rigid);
462
463                 
464                 virtual void            resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ);
465
466                 // clientinfo for raycasts for example
467                 virtual void*                           getNewClientInfo();
468                 virtual void                            setNewClientInfo(void* clientinfo);
469                 virtual PHY_IPhysicsController* GetReplica();
470                 
471                 ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors
472                 short int       GetCollisionFilterGroup() const
473                 {
474                         return m_cci.m_collisionFilterGroup;
475                 }
476                 ///There should be no 'SetCollisionFilterGroup' method, as changing this during run-time is will result in errors
477                 short int       GetCollisionFilterMask() const
478                 {
479                         return m_cci.m_collisionFilterMask;
480                 }
481
482                 virtual void    calcXform() {} ;
483                 virtual void SetMargin(float margin) 
484                 {
485                         if (m_collisionShape)
486                                 m_collisionShape->setMargin(btScalar(margin));
487                 }
488                 virtual float GetMargin() const 
489                 {
490                         return (m_collisionShape) ? m_collisionShape->getMargin() : 0.f;
491                 }
492                 virtual float GetRadius() const 
493                 { 
494                         // this is not the actual shape radius, it's only used for Fh support
495                         return m_cci.m_radius;
496                 }
497                 virtual void  SetRadius(float margin) 
498                 {
499                         if (m_collisionShape && m_collisionShape->getShapeType() == SPHERE_SHAPE_PROXYTYPE)
500                         {
501                                 btSphereShape* sphereShape = static_cast<btSphereShape*>(m_collisionShape);
502                                 sphereShape->setUnscaledRadius(margin);
503                         }
504                         m_cci.m_radius = margin;
505                 }
506                 
507                 // velocity clamping
508                 virtual void SetLinVelocityMin(float val) 
509                 {
510                         m_cci.m_clamp_vel_min= val;
511                 }
512                 virtual float GetLinVelocityMin() const 
513                 {
514                         return m_cci.m_clamp_vel_min;
515                 }
516                 virtual void SetLinVelocityMax(float val) 
517                 {
518                         m_cci.m_clamp_vel_max= val;
519                 }
520                 virtual float GetLinVelocityMax() const 
521                 {
522                         return m_cci.m_clamp_vel_max;
523                 }
524
525                 bool    wantsSleeping();
526
527                 void    UpdateDeactivation(float timeStep);
528
529                 void    SetCenterOfMassTransform(btTransform& xform);
530
531                 static btTransform&     GetTransformFromMotionState(PHY_IMotionState* motionState);
532
533                 void    setAabb(const btVector3& aabbMin,const btVector3& aabbMax);
534
535
536                 class   PHY_IMotionState*                       GetMotionState()
537                 {
538                         return m_MotionState;
539                 }
540
541                 const class     PHY_IMotionState*                       GetMotionState() const
542                 {
543                         return m_MotionState;
544                 }
545
546                 class CcdPhysicsEnvironment* GetPhysicsEnvironment()
547                 {
548                         return m_cci.m_physicsEnv;
549                 }
550
551                 void    setParentCtrl(CcdPhysicsController* parentCtrl)
552                 {
553                         m_parentCtrl = parentCtrl;
554                 }
555
556                 CcdPhysicsController*   getParentCtrl()
557                 {
558                         return m_parentCtrl;
559                 }
560
561                 const CcdPhysicsController*     getParentCtrl() const
562                 {
563                         return m_parentCtrl;
564                 }
565
566
567 #ifdef WITH_CXX_GUARDEDALLOC
568 public:
569         void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:CcdPhysicsController"); }
570         void operator delete( void *mem ) { MEM_freeN(mem); }
571 #endif
572 };
573
574
575
576
577 ///DefaultMotionState implements standard motionstate, using btTransform
578 class   DefaultMotionState : public PHY_IMotionState
579
580 {
581         public:
582                 DefaultMotionState();
583
584                 virtual ~DefaultMotionState();
585
586                 virtual void    getWorldPosition(float& posX,float& posY,float& posZ);
587                 virtual void    getWorldScaling(float& scaleX,float& scaleY,float& scaleZ);
588                 virtual void    getWorldOrientation(float& quatIma0,float& quatIma1,float& quatIma2,float& quatReal);
589                 
590                 virtual void    setWorldPosition(float posX,float posY,float posZ);
591                 virtual void    setWorldOrientation(float quatIma0,float quatIma1,float quatIma2,float quatReal);
592                 virtual void    getWorldOrientation(float* ori);
593                 virtual void    setWorldOrientation(const float* ori);
594                 
595                 virtual void    calculateWorldTransformations();
596                 
597                 btTransform     m_worldTransform;
598                 btVector3               m_localScaling;
599         
600         
601 #ifdef WITH_CXX_GUARDEDALLOC
602 public:
603         void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:DefaultMotionState"); }
604         void operator delete( void *mem ) { MEM_freeN(mem); }
605 #endif
606 };
607
608
609 #endif //BULLET2_PHYSICSCONTROLLER_H