Changeset View
Changeset View
Standalone View
Standalone View
source/gameengine/GameLogic/SCA_NearSensor.h
- This file was moved from source/gameengine/Ketsji/KX_NearSensor.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_NearSensor.h | /** \file SCA_NearSensor.h | ||||
| * \ingroup ketsji | * \ingroup gamelogic | ||||
| * \brief Sense if other objects are near | * \brief Sense if other objects are near | ||||
| */ | */ | ||||
| #ifndef __KX_NEARSENSOR_H__ | #ifndef __SCA_NEARSENSOR_H__ | ||||
| #define __KX_NEARSENSOR_H__ | #define __SCA_NEARSENSOR_H__ | ||||
| #include "KX_TouchSensor.h" | #include "SCA_TouchSensor.h" | ||||
| #include "KX_ClientObjectInfo.h" | #include "KX_ClientObjectInfo.h" | ||||
| class KX_Scene; | class KX_Scene; | ||||
| struct PHY_CollData; | struct PHY_CollData; | ||||
| class KX_NearSensor : public KX_TouchSensor | class SCA_NearSensor : public SCA_TouchSensor | ||||
| { | { | ||||
| Py_Header | Py_Header | ||||
| protected: | protected: | ||||
| float m_Margin; | float m_Margin; | ||||
| float m_ResetMargin; | float m_ResetMargin; | ||||
| KX_ClientObjectInfo* m_client_info; | KX_ClientObjectInfo* m_client_info; | ||||
| public: | public: | ||||
| KX_NearSensor(class SCA_EventManager* eventmgr, | SCA_NearSensor(class SCA_EventManager* eventmgr, | ||||
| class KX_GameObject* gameobj, | class KX_GameObject* gameobj, | ||||
| float margin, | float margin, | ||||
| float resetmargin, | float resetmargin, | ||||
| bool bFindMaterial, | bool bFindMaterial, | ||||
| const STR_String& touchedpropname, | const STR_String& touchedpropname, | ||||
| PHY_IPhysicsController* ctrl); | PHY_IPhysicsController* ctrl); | ||||
| #if 0 | #if 0 | ||||
| public: | public: | ||||
| KX_NearSensor(class SCA_EventManager* eventmgr, | SCA_NearSensor(class SCA_EventManager* eventmgr, | ||||
| class KX_GameObject* gameobj, | class KX_GameObject* gameobj, | ||||
| double margin, | double margin, | ||||
| double resetmargin, | double resetmargin, | ||||
| bool bFindMaterial, | bool bFindMaterial, | ||||
| const STR_String& touchedpropname, | const STR_String& touchedpropname, | ||||
| class KX_Scene* scene); | class KX_Scene* scene); | ||||
| #endif | #endif | ||||
| virtual ~KX_NearSensor(); | virtual ~SCA_NearSensor(); | ||||
| virtual void SynchronizeTransform(); | virtual void SynchronizeTransform(); | ||||
| virtual CValue* GetReplica(); | virtual CValue* GetReplica(); | ||||
| virtual void ProcessReplica(); | virtual void ProcessReplica(); | ||||
| virtual void SetPhysCtrlRadius(); | virtual void SetPhysCtrlRadius(); | ||||
| virtual bool Evaluate(); | virtual bool Evaluate(); | ||||
| virtual void ReParent(SCA_IObject* parent); | virtual void ReParent(SCA_IObject* parent); | ||||
| virtual bool NewHandleCollision(void* obj1,void* obj2, | virtual bool NewHandleCollision(void* obj1,void* obj2, | ||||
| const PHY_CollData * coll_data); | const PHY_CollData * coll_data); | ||||
| virtual bool BroadPhaseFilterCollision(void*obj1,void*obj2); | virtual bool BroadPhaseFilterCollision(void*obj1,void*obj2); | ||||
| virtual bool BroadPhaseSensorFilterCollision(void* obj1,void* obj2) { return false; } | virtual bool BroadPhaseSensorFilterCollision(void* obj1,void* obj2) { return false; } | ||||
| virtual sensortype GetSensorType() { return ST_NEAR; } | virtual sensortype GetSensorType() { return ST_NEAR; } | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| /* --------------------------------------------------------------------- */ | /* --------------------------------------------------------------------- */ | ||||
| /* Python interface ---------------------------------------------------- */ | /* Python interface ---------------------------------------------------- */ | ||||
| /* --------------------------------------------------------------------- */ | /* --------------------------------------------------------------------- */ | ||||
| //No methods | //No methods | ||||
| //This method is used to make sure the distance does not exceed the reset distance | //This method is used to make sure the distance does not exceed the reset distance | ||||
| static int CheckResetDistance(void *self, const PyAttributeDef*) | static int CheckResetDistance(void *self, const PyAttributeDef*) | ||||
| { | { | ||||
| KX_NearSensor* sensor = reinterpret_cast<KX_NearSensor*>(self); | SCA_NearSensor* sensor = reinterpret_cast<SCA_NearSensor*>(self); | ||||
| if (sensor->m_Margin > sensor->m_ResetMargin) | if (sensor->m_Margin > sensor->m_ResetMargin) | ||||
| sensor->m_ResetMargin = sensor->m_Margin; | sensor->m_ResetMargin = sensor->m_Margin; | ||||
| sensor->SetPhysCtrlRadius(); | sensor->SetPhysCtrlRadius(); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| }; | }; | ||||
| #endif /* __KX_NEARSENSOR_H__ */ | #endif /* __SCA_NEARSENSOR_H__ */ | ||||