Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

KX_PhysicsController.h

Go to the documentation of this file.
00001 #ifndef __KX_PHYSICSCONTROLLER_H
00002 #define __KX_PHYSICSCONTROLLER_H
00003 
00004 #include "SG_Controller.h"
00005 #include "MT_Vector3.h"
00006 #include "SM_Object.h" // for SM_Callback
00007 
00014 
00015 class KX_PhysicsController : public SG_Controller,
00016                                                          public SM_Callback
00017 {
00018         class SM_Object*        m_sumoObj;
00019         class SM_Scene*         m_sumoScene; // needed for replication
00020 
00021         bool            m_bDyna;
00022         bool            m_suspendDynamics;
00023 
00024 public:
00025         KX_PhysicsController(class SM_Scene* sumoScene,class SM_Object* sumoObj,bool dyna) 
00026                 : m_sumoScene(sumoScene),m_sumoObj(sumoObj) , m_bDyna(dyna),
00027         m_suspendDynamics(false) {
00028         };
00029         virtual ~KX_PhysicsController()

00030         {
00031         }
00032         
00033         virtual void    SetObject (SG_IObject* object);
00034 
00035         void    SetSumoObject(class SM_Object* sumoObj) {
00036                 m_sumoObj = sumoObj;
00037         }
00038         void    SetSumoScene(class SM_Scene* sumoScene) {
00039                 m_sumoScene = sumoScene;
00040         }
00041         SM_Object*      GetSumoObject() {
00042                 return m_sumoObj;
00043         };
00044         void    RelativeTranslate(const MT_Vector3& dloc,bool local);
00045         void    RelativeRotate(const MT_Matrix3x3& drot,bool local);
00046         void    ApplyTorque(const MT_Vector3& torque,bool local);
00047         void    ApplyForce(const MT_Vector3& force,bool local);
00048         MT_Vector3 GetLinearVelocity();
00049         MT_Vector3 GetVelocity(const MT_Point3& pos);
00050         void    SetAngularVelocity(const MT_Vector3& ang_vel,bool local);
00051         void    SetLinearVelocity(const MT_Vector3& lin_vel,bool local);
00052 
00053         void    SuspendDynamics();
00054         void    RestoreDynamics();
00055         
00056 
00057         virtual SG_Controller*  GetReplica();
00058 
00059         void    SetDyna(bool isDynamic) {
00060                 m_bDyna = isDynamic;
00061         }
00062         void    SetSumoTransform();
00063         // todo: remove next line !
00064         virtual void    SetSimulatedTime(double time);
00065         
00066         // call from scene graph to update
00067         virtual bool Update(double time);
00068         // callback from sumo
00069         virtual void do_me();
00070 
00071 
00072 };
00073 #endif //__KX_PHYSICSCONTROLLER_H

Generated at Thu Feb 1 13:03:06 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000