Blender V2.61 - r43446
|
00001 00006 #ifndef KX_BULLET2PHYSICS_CONTROLLER 00007 #define KX_BULLET2PHYSICS_CONTROLLER 00008 00009 00010 #include "KX_IPhysicsController.h" 00011 #ifdef USE_BULLET 00012 #include "CcdPhysicsController.h" 00013 #endif 00014 00015 class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysicsController 00016 { 00017 private: 00018 int m_savedCollisionFlags; 00019 int m_savedActivationState; 00020 short int m_savedCollisionFilterGroup; 00021 short int m_savedCollisionFilterMask; 00022 MT_Scalar m_savedMass; 00023 bool m_savedDyna; 00024 bool m_suspended; 00025 btCollisionShape* m_bulletChildShape; 00026 00027 public: 00028 #ifdef USE_BULLET 00029 KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound); 00030 virtual ~KX_BulletPhysicsController (); 00031 #endif 00032 00033 // KX_IPhysicsController interface 00035 00036 virtual void applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse); 00037 virtual void SetObject (SG_IObject* object); 00038 virtual void setMargin (float collisionMargin); 00039 virtual void RelativeTranslate(const MT_Vector3& dloc,bool local); 00040 virtual void RelativeRotate(const MT_Matrix3x3& drot,bool local); 00041 virtual void ApplyTorque(const MT_Vector3& torque,bool local); 00042 virtual void ApplyForce(const MT_Vector3& force,bool local); 00043 virtual MT_Vector3 GetLinearVelocity(); 00044 virtual MT_Vector3 GetAngularVelocity(); 00045 virtual MT_Vector3 GetVelocity(const MT_Point3& pos); 00046 virtual void SetAngularVelocity(const MT_Vector3& ang_vel,bool local); 00047 virtual void SetLinearVelocity(const MT_Vector3& lin_vel,bool local); 00048 virtual void getOrientation(MT_Quaternion& orn); 00049 virtual void setOrientation(const MT_Matrix3x3& orn); 00050 virtual void setPosition(const MT_Point3& pos); 00051 virtual void setScaling(const MT_Vector3& scaling); 00052 virtual void SetTransform(); 00053 virtual MT_Scalar GetMass(); 00054 virtual void SetMass(MT_Scalar newmass); 00055 virtual MT_Vector3 GetLocalInertia(); 00056 virtual MT_Vector3 getReactionForce(); 00057 virtual void setRigidBody(bool rigid); 00058 virtual void AddCompoundChild(KX_IPhysicsController* child); 00059 virtual void RemoveCompoundChild(KX_IPhysicsController* child); 00060 00061 virtual void resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ); 00062 00063 virtual void SuspendDynamics(bool ghost); 00064 virtual void RestoreDynamics(); 00065 00066 virtual SG_Controller* GetReplica(class SG_Node* destnode); 00067 00068 virtual MT_Scalar GetRadius(); 00069 00070 virtual float GetLinVelocityMin(); 00071 virtual void SetLinVelocityMin(float val); 00072 virtual float GetLinVelocityMax(); 00073 virtual void SetLinVelocityMax(float val); 00074 00075 virtual void SetSumoTransform(bool nondynaonly); 00076 // todo: remove next line ! 00077 virtual void SetSimulatedTime(double time); 00078 00079 // call from scene graph to update 00080 virtual bool Update(double time); 00081 void* GetUserData() { return m_userdata;} 00082 00083 virtual const char* getName(); 00084 00085 void 00086 SetOption( 00087 int option, 00088 int value 00089 ){ 00090 // intentionally empty 00091 }; 00092 00093 00094 #ifdef WITH_CXX_GUARDEDALLOC 00095 public: 00096 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_BulletPhysicsController"); } 00097 void operator delete( void *mem ) { MEM_freeN(mem); } 00098 #endif 00099 }; 00100 00101 #endif //KX_BULLET2PHYSICS_CONTROLLER 00102