00001 00006 00007 #ifndef __KX_RAYSENSOR_H 00008 #define __KX_RAYSENSOR_H 00009 00010 #include "SCA_ISensor.h" 00011 #include "MT_Point3.h" 00012 00013 class KX_RaySensor : public SCA_ISensor 00014 { 00015 Py_Header; 00016 CCString m_propertyname; 00017 bool m_bFindMaterial; 00018 double m_distance; 00019 class SM_Scene* m_sumoScene; 00020 bool m_bTriggered; 00021 bool m_rayHit; 00022 MT_Point3 m_hitPosition; 00023 SCA_IObject* m_hitObject; 00024 MT_Vector3 m_hitNormal; 00025 00026 00027 public: 00028 KX_RaySensor(class SCA_EventManager* eventmgr, 00029 SCA_IObject* gameobj, 00030 const CCString& propname, 00031 bool fFindMaterial, 00032 double distance, 00033 class SM_Scene* sumoScene, 00034 PyTypeObject* T =&Type); 00035 virtual ~KX_RaySensor(); 00036 virtual CValue* GetReplica() { 00037 CValue* replica = new KX_RaySensor(*this); 00038 // this will copy properties and so on... 00039 CValue::AddDataToReplica(replica); 00040 return replica; 00041 }; 00042 00043 virtual bool Evaluate(CValue* event); 00044 virtual bool IsPositiveTrigger() { 00045 bool result = m_rayHit; 00046 if (m_invert) result = !result; 00047 return result; 00048 }; 00049 00050 KX_PYMETHOD_DOC(KX_RaySensor,GetHitObject); 00051 KX_PYMETHOD_DOC(KX_RaySensor,GetHitPosition); 00052 KX_PYMETHOD_DOC(KX_RaySensor,GetHitNormal); 00053 00054 virtual PyObject* _getattr(char *attr); 00055 00056 }; 00057 #endif //__KX_RAYSENSOR_H