Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/GameLogic/SCA_ObjectActuator.h
- This file was moved from source/gameengine/Ketsji/KX_ObjectActuator.h.
| Show All 19 Lines | |||||
| * | * | ||||
| * The Original Code is: all of this file. | * The Original Code is: all of this file. | ||||
| * | * | ||||
| * Contributor(s): none yet. | * Contributor(s): none yet. | ||||
| * | * | ||||
| * ***** END GPL LICENSE BLOCK ***** | * ***** END GPL LICENSE BLOCK ***** | ||||
| */ | */ | ||||
| /** \file KX_ObjectActuator.h | /** \file SCA_ObjectActuator.h | ||||
| * \ingroup ketsji | * \ingroup gamelogic | ||||
| * \brief Do translation/rotation actions | * \brief Do translation/rotation actions | ||||
| */ | */ | ||||
| #ifndef __KX_OBJECTACTUATOR_H__ | #ifndef __SCA_OBJECTACTUATOR_H__ | ||||
| #define __KX_OBJECTACTUATOR_H__ | #define __SCA_OBJECTACTUATOR_H__ | ||||
| #include "SCA_IActuator.h" | #include "SCA_IActuator.h" | ||||
| #include "MT_Vector3.h" | #include "MT_Vector3.h" | ||||
| #ifdef USE_MATHUTILS | #ifdef USE_MATHUTILS | ||||
| void KX_ObjectActuator_Mathutils_Callback_Init(void); | void SCA_ObjectActuator_Mathutils_Callback_Init(void); | ||||
| #endif | #endif | ||||
| class KX_GameObject; | class KX_GameObject; | ||||
| // | // | ||||
| // Stores the flags for each CValue derived class | // Stores the flags for each CValue derived class | ||||
| // | // | ||||
| struct KX_LocalFlags { | struct KX_LocalFlags { | ||||
| Show All 32 Lines | struct KX_LocalFlags { | ||||
| bool ZeroForce; | bool ZeroForce; | ||||
| bool ZeroTorque; | bool ZeroTorque; | ||||
| bool ZeroDRot; | bool ZeroDRot; | ||||
| bool ZeroDLoc; | bool ZeroDLoc; | ||||
| bool ZeroLinearVelocity; | bool ZeroLinearVelocity; | ||||
| bool ZeroAngularVelocity; | bool ZeroAngularVelocity; | ||||
| }; | }; | ||||
| class KX_ObjectActuator : public SCA_IActuator | class SCA_ObjectActuator : public SCA_IActuator | ||||
| { | { | ||||
| Py_Header | Py_Header | ||||
| MT_Vector3 m_force; | MT_Vector3 m_force; | ||||
| MT_Vector3 m_torque; | MT_Vector3 m_torque; | ||||
| MT_Vector3 m_dloc; | MT_Vector3 m_dloc; | ||||
| MT_Vector3 m_drot; | MT_Vector3 m_drot; | ||||
| MT_Vector3 m_linear_velocity; | MT_Vector3 m_linear_velocity; | ||||
| Show All 31 Lines | enum KX_OBJECT_ACT_VEC_TYPE { | ||||
| KX_OBJECT_ACT_MAX | KX_OBJECT_ACT_MAX | ||||
| }; | }; | ||||
| /** | /** | ||||
| * Check whether this is a valid vector mode | * Check whether this is a valid vector mode | ||||
| */ | */ | ||||
| bool isValid(KX_OBJECT_ACT_VEC_TYPE type); | bool isValid(KX_OBJECT_ACT_VEC_TYPE type); | ||||
| KX_ObjectActuator( | SCA_ObjectActuator( | ||||
| SCA_IObject* gameobj, | SCA_IObject* gameobj, | ||||
| KX_GameObject* refobj, | KX_GameObject* refobj, | ||||
| const MT_Vector3& force, | const MT_Vector3& force, | ||||
| const MT_Vector3& torque, | const MT_Vector3& torque, | ||||
| const MT_Vector3& dloc, | const MT_Vector3& dloc, | ||||
| const MT_Vector3& drot, | const MT_Vector3& drot, | ||||
| const MT_Vector3& linV, | const MT_Vector3& linV, | ||||
| const MT_Vector3& angV, | const MT_Vector3& angV, | ||||
| const short damping, | const short damping, | ||||
| const KX_LocalFlags& flag | const KX_LocalFlags& flag | ||||
| ); | ); | ||||
| ~KX_ObjectActuator(); | ~SCA_ObjectActuator(); | ||||
| CValue* GetReplica(); | CValue* GetReplica(); | ||||
| void ProcessReplica(); | void ProcessReplica(); | ||||
| bool UnlinkObject(SCA_IObject* clientobj); | bool UnlinkObject(SCA_IObject* clientobj); | ||||
| void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map); | void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map); | ||||
| void SetForceLoc(const double force[3]) { /*m_force=force;*/ } | void SetForceLoc(const double force[3]) { /*m_force=force;*/ } | ||||
| void UpdateFuzzyFlags() | void UpdateFuzzyFlags() | ||||
| { | { | ||||
| Show All 29 Lines | #ifdef USE_MATHUTILS | ||||
| static int pyattr_set_linV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); | static int pyattr_set_linV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); | ||||
| static PyObject* pyattr_get_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); | static PyObject* pyattr_get_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef); | ||||
| static int pyattr_set_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); | static int pyattr_set_angV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value); | ||||
| #endif | #endif | ||||
| // This lets the attribute macros use UpdateFuzzyFlags() | // This lets the attribute macros use UpdateFuzzyFlags() | ||||
| static int PyUpdateFuzzyFlags(void *self, const PyAttributeDef *attrdef) | static int PyUpdateFuzzyFlags(void *self, const PyAttributeDef *attrdef) | ||||
| { | { | ||||
| KX_ObjectActuator* act = reinterpret_cast<KX_ObjectActuator*>(self); | SCA_ObjectActuator* act = reinterpret_cast<SCA_ObjectActuator*>(self); | ||||
| act->UpdateFuzzyFlags(); | act->UpdateFuzzyFlags(); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| // This is the keep the PID values in check after they are assigned with Python | // This is the keep the PID values in check after they are assigned with Python | ||||
| static int PyCheckPid(void *self, const PyAttributeDef *attrdef) | static int PyCheckPid(void *self, const PyAttributeDef *attrdef) | ||||
| { | { | ||||
| KX_ObjectActuator* act = reinterpret_cast<KX_ObjectActuator*>(self); | SCA_ObjectActuator* act = reinterpret_cast<SCA_ObjectActuator*>(self); | ||||
| //P 0 to 200 | //P 0 to 200 | ||||
| if (act->m_pid[0] < 0) { | if (act->m_pid[0] < 0) { | ||||
| act->m_pid[0] = 0; | act->m_pid[0] = 0; | ||||
| } else if (act->m_pid[0] > 200) { | } else if (act->m_pid[0] > 200) { | ||||
| act->m_pid[0] = 200; | act->m_pid[0] = 200; | ||||
| } | } | ||||
| Show All 13 Lines | static int PyCheckPid(void *self, const PyAttributeDef *attrdef) | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| }; | }; | ||||
| #endif /* __KX_OBJECTACTUATOR_H__ */ | #endif /* __SCA_OBJECTACTUATOR_H__ */ | ||||