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

KX_ObjectActuator.h

Go to the documentation of this file.
00001 
00006 
00007 #ifndef __KX_OBJECTACTUATOR
00008 #define __KX_OBJECTACTUATOR
00009 
00010 #include "SCA_IActuator.h"
00011 #include "MT_Vector3.h"
00012 
00013 
00014 //
00015 // Bitfield that stores the flags for each CValue derived class
00016 //
00017 struct KX_LocalFlags {
00018         KX_LocalFlags() :
00019                 Force(false),
00020                 Torque(false),
00021                 DRot(false),
00022                 DLoc(false),
00023                 LinearVelocity(false),
00024                 AngularVelocity(false)
00025         {
00026         }
00027 
00028         unsigned short Force : 1;
00029         unsigned short Torque : 1;
00030         unsigned short DRot : 1;
00031         unsigned short DLoc : 1;
00032         unsigned short LinearVelocity : 1;
00033         unsigned short AngularVelocity : 1;
00034 };
00035 
00036 class KX_ObjectActuator : public SCA_IActuator
00037 {
00038         Py_Header;
00039         
00040         MT_Vector3      m_force;
00041         MT_Vector3      m_torque;
00042         MT_Vector3      m_dloc;
00043         MT_Vector3      m_drot;
00044         MT_Vector3  m_linear_velocity;
00045         MT_Vector3  m_angular_velocity; 
00046         KX_LocalFlags   m_bitLocalFlag;
00047 public:
00048         enum KX_OBJECT_ACT_VEC_TYPE {
00049                 KX_OBJECT_ACT_NODEF = 0,
00050                 KX_OBJECT_ACT_FORCE,
00051                 KX_OBJECT_ACT_TORQUE,
00052                 KX_OBJECT_ACT_DLOC,
00053                 KX_OBJECT_ACT_DROT,
00054                 KX_OBJECT_ACT_LINEAR_VELOCITY,
00055                 KX_OBJECT_ACT_ANGULAR_VELOCITY,
00056                 KX_OBJECT_ACT_MAX
00057         };
00058                 
00062         bool isValid(KX_OBJECT_ACT_VEC_TYPE type);
00063 
00064         KX_ObjectActuator(SCA_IObject* gameobj,
00065                                           const MT_Vector3& force,
00066                                           const MT_Vector3& torque,
00067                                           const MT_Vector3& dloc,
00068                                           const MT_Vector3& drot,
00069                                           const MT_Vector3& linV,
00070                                           const MT_Vector3& angV,
00071                                           const KX_LocalFlags& flag,
00072                                           PyTypeObject* T=&Type) 
00073                 : SCA_IActuator(gameobj,T),
00074                 m_force(force),
00075                 m_torque(torque),
00076                 m_dloc(dloc),
00077                 m_drot(drot),
00078                 m_linear_velocity(linV),
00079                 m_angular_velocity(angV)

00080         

00081         {
00082                 m_bitLocalFlag = flag;
00083         }
00084         virtual CValue* GetReplica() {
00085                 KX_ObjectActuator* replica = new KX_ObjectActuator(*this);//m_float,GetName());
00086                 replica->ProcessReplica();
00087                 // this will copy properties and so on...
00088                 CValue::AddDataToReplica(replica);
00089                 return replica;
00090         };
00091 
00092         void    SetForceLoc(const double force[3])

00093         {
00094                 //m_force=force;
00095         }
00096         virtual bool Update(double curtime,double deltatime);
00097 
00098         /* --------------------------------------------------------------------- */
00099         /* Python interface ---------------------------------------------------- */
00100         /* --------------------------------------------------------------------- */
00101         
00102         virtual PyObject*  _getattr(char *attr);
00103 
00104         /* 1. set: set parameters                                                 */
00105         /* Removed */
00106         
00107         /* 2. getForce                                                            */
00108         PyObject* PyGetForce(PyObject* self, PyObject* args, PyObject* kwds);
00109         static PyObject* sPyGetForce(PyObject* self, PyObject* args, PyObject* kwds) {
00110                 return ((KX_ObjectActuator*) self)->PyGetForce(self, args, kwds);
00111         };
00112         /* 3. setForce                                                            */
00113         PyObject* PySetForce(PyObject* self, PyObject* args, PyObject* kwds);
00114         static PyObject* sPySetForce(PyObject* self, PyObject* args, PyObject* kwds) {
00115                 return ((KX_ObjectActuator*) self)->PySetForce(self, args, kwds);
00116         };
00117 
00118         /* 4. getTorque                                                           */
00119         PyObject* PyGetTorque(PyObject* self, PyObject* args, PyObject* kwds);
00120         static PyObject* sPyGetTorque(PyObject* self, PyObject* args, PyObject* kwds) {
00121                 return ((KX_ObjectActuator*) self)->PyGetTorque(self, args, kwds);
00122         };
00123         /* 5. setTorque                                                           */
00124         PyObject* PySetTorque(PyObject* self, PyObject* args, PyObject* kwds);
00125         static PyObject* sPySetTorque(PyObject* self, PyObject* args, PyObject* kwds) {
00126                 return ((KX_ObjectActuator*) self)->PySetTorque(self, args, kwds);
00127         };
00128 
00129         /* 6. getDLoc                                                            */
00130         PyObject* PyGetDLoc(PyObject* self, PyObject* args, PyObject* kwds);
00131         static PyObject* sPyGetDLoc(PyObject* self, PyObject* args, PyObject* kwds) {
00132                 return ((KX_ObjectActuator*) self)->PyGetDLoc(self, args, kwds);
00133         };
00134         /* 7. setDLoc                                                            */
00135         PyObject* PySetDLoc(PyObject* self, PyObject* args, PyObject* kwds);
00136         static PyObject* sPySetDLoc(PyObject* self, PyObject* args, PyObject* kwds) {
00137                 return ((KX_ObjectActuator*) self)->PySetDLoc(self, args, kwds);
00138         };
00139 
00140         /* 8. getDRot                                                            */
00141         PyObject* PyGetDRot(PyObject* self, PyObject* args, PyObject* kwds);
00142         static PyObject* sPyGetDRot(PyObject* self, PyObject* args, PyObject* kwds) {
00143                 return ((KX_ObjectActuator*) self)->PyGetDRot(self, args, kwds);
00144         };
00145         /* 9. setDRot                                                            */
00146         PyObject* PySetDRot(PyObject* self, PyObject* args, PyObject* kwds);
00147         static PyObject* sPySetDRot(PyObject* self, PyObject* args, PyObject* kwds) {
00148                 return ((KX_ObjectActuator*) self)->PySetDRot(self, args, kwds);
00149         };
00150 
00151         /* 10. getLinearVelocity                                                 */
00152         PyObject* PyGetLinearVelocity(PyObject* self, PyObject* args, PyObject* kwds);
00153         static PyObject* sPyGetLinearVelocity(PyObject* self, PyObject* args, PyObject* kwds) {
00154                 return ((KX_ObjectActuator*) self)->PyGetLinearVelocity(self, args, kwds);
00155         };
00156         /* 11. setLinearVelocity                                                 */
00157         PyObject* PySetLinearVelocity(PyObject* self, PyObject* args, PyObject* kwds);
00158         static PyObject* sPySetLinearVelocity(PyObject* self, PyObject* args, PyObject* kwds) {
00159                 return ((KX_ObjectActuator*) self)->PySetLinearVelocity(self, args, kwds);
00160         };
00161 
00162         /* 12. getAngularVelocity                                                */
00163         PyObject* PyGetAngularVelocity(PyObject* self, PyObject* args, PyObject* kwds);
00164         static PyObject* sPyGetAngularVelocity(PyObject* self, PyObject* args, PyObject* kwds) {
00165                 return ((KX_ObjectActuator*) self)->PyGetAngularVelocity(self, args, kwds);
00166         };
00167         /* 13. setAngularVelocity                                                */
00168         PyObject* PySetAngularVelocity(PyObject* self, PyObject* args, PyObject* kwds);
00169         static PyObject* sPySetAngularVelocity(PyObject* self, PyObject* args, PyObject* kwds) {
00170                 return ((KX_ObjectActuator*) self)->PySetAngularVelocity(self, args, kwds);
00171         };
00172                 
00173 };
00174 #endif //__KX_OBJECTACTUATOR

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