BGE API cleanup: apply patch from Moguri: Near, Radar, Touch sensor updated.
This commit is contained in:
@@ -42,8 +42,8 @@
|
||||
#endif
|
||||
KX_NearSensor::KX_NearSensor(SCA_EventManager* eventmgr,
|
||||
KX_GameObject* gameobj,
|
||||
double margin,
|
||||
double resetmargin,
|
||||
float margin,
|
||||
float resetmargin,
|
||||
bool bFindMaterial,
|
||||
const STR_String& touchedpropname,
|
||||
class KX_Scene* scene,
|
||||
@@ -276,8 +276,16 @@ bool KX_NearSensor::NewHandleCollision(void* obj1,void* obj2,const PHY_CollData
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python Functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
//No methods
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python Integration Hooks */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
// python embedding
|
||||
PyTypeObject KX_NearSensor::Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
@@ -311,20 +319,31 @@ PyParentObject KX_NearSensor::Parents[] = {
|
||||
|
||||
|
||||
PyMethodDef KX_NearSensor::Methods[] = {
|
||||
{"setProperty", (PyCFunction) KX_NearSensor::sPySetProperty, METH_O, (PY_METHODCHAR)SetProperty_doc},
|
||||
{"getProperty", (PyCFunction) KX_NearSensor::sPyGetProperty, METH_NOARGS, (PY_METHODCHAR)GetProperty_doc},
|
||||
{"getHitObject",(PyCFunction) KX_NearSensor::sPyGetHitObject, METH_NOARGS, (PY_METHODCHAR)GetHitObject_doc},
|
||||
{"getHitObjectList", (PyCFunction) KX_NearSensor::sPyGetHitObjectList, METH_NOARGS, (PY_METHODCHAR)GetHitObjectList_doc},
|
||||
//No methods
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyAttributeDef KX_NearSensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
KX_PYATTRIBUTE_FLOAT_RW_CHECK("distance", 0, 100, KX_NearSensor, m_Margin, CheckResetDistance),
|
||||
KX_PYATTRIBUTE_FLOAT_RW_CHECK("resetDistance", 0, 100, KX_NearSensor, m_ResetMargin, CheckResetDistance),
|
||||
{NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyObject*
|
||||
KX_NearSensor::_getattr(const char *attr)
|
||||
|
||||
PyObject* KX_NearSensor::_getattr(const char *attr)
|
||||
{
|
||||
PyObject* object = _getattr_self(Attributes, this, attr);
|
||||
if (object != NULL)
|
||||
return object;
|
||||
|
||||
_getattr_up(KX_TouchSensor);
|
||||
}
|
||||
|
||||
int KX_NearSensor::_setattr(const char *attr, PyObject* value)
|
||||
{
|
||||
int ret = _setattr_self(Attributes, this, attr, value);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
|
||||
return KX_TouchSensor::_setattr(attr, value);
|
||||
}
|
||||
|
@@ -42,15 +42,15 @@ class KX_NearSensor : public KX_TouchSensor
|
||||
{
|
||||
Py_Header;
|
||||
protected:
|
||||
double m_Margin;
|
||||
double m_ResetMargin;
|
||||
float m_Margin;
|
||||
float m_ResetMargin;
|
||||
KX_Scene* m_scene;
|
||||
KX_ClientObjectInfo* m_client_info;
|
||||
public:
|
||||
KX_NearSensor(class SCA_EventManager* eventmgr,
|
||||
class KX_GameObject* gameobj,
|
||||
double margin,
|
||||
double resetmargin,
|
||||
float margin,
|
||||
float resetmargin,
|
||||
bool bFindMaterial,
|
||||
const STR_String& touchedpropname,
|
||||
class KX_Scene* scene,
|
||||
@@ -79,7 +79,24 @@ public:
|
||||
virtual void RegisterSumo(KX_TouchEventManager *touchman);
|
||||
virtual void UnregisterSumo(KX_TouchEventManager* touchman);
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
virtual PyObject* _getattr(const char *attr);
|
||||
virtual int _setattr(const char *attr, PyObject* value);
|
||||
|
||||
//No methods
|
||||
|
||||
//This method is used to make sure the distance does not exceed the reset distance
|
||||
static int CheckResetDistance(void *self, const PyAttributeDef*)
|
||||
{
|
||||
KX_NearSensor* sensor = reinterpret_cast<KX_NearSensor*>(self);
|
||||
|
||||
if (sensor->m_Margin > sensor->m_ResetMargin)
|
||||
sensor->m_ResetMargin = sensor->m_Margin;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include "KX_PyConstraintBinding.h"
|
||||
|
||||
#include "KX_KetsjiEngine.h"
|
||||
#include "KX_RadarSensor.h"
|
||||
|
||||
#include "SCA_IInputDevice.h"
|
||||
#include "SCA_PropertySensor.h"
|
||||
@@ -1060,6 +1061,14 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
|
||||
KX_MACRO_addTypesToDict(d, KX_STATE29, (1<<28));
|
||||
KX_MACRO_addTypesToDict(d, KX_STATE30, (1<<29));
|
||||
|
||||
/* Radar Sensor */
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_X, KX_RadarSensor::KX_RADAR_AXIS_POS_X);
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_Y, KX_RadarSensor::KX_RADAR_AXIS_POS_Y);
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_POS_Z, KX_RadarSensor::KX_RADAR_AXIS_POS_Z);
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_X, KX_RadarSensor::KX_RADAR_AXIS_NEG_Y);
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_Y, KX_RadarSensor::KX_RADAR_AXIS_NEG_X);
|
||||
KX_MACRO_addTypesToDict(d, KX_RADAR_AXIS_NEG_Z, KX_RadarSensor::KX_RADAR_AXIS_NEG_Z);
|
||||
|
||||
// Check for errors
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
|
@@ -171,8 +171,18 @@ void KX_RadarSensor::SynchronizeTransform()
|
||||
{
|
||||
}
|
||||
}
|
||||
m_cone_origin = trans.getOrigin();
|
||||
m_cone_target = trans(MT_Point3(0, -m_coneheight/2.0 ,0));
|
||||
|
||||
//Using a temp variable to translate MT_Point3 to float[3].
|
||||
//float[3] works better for the Python interface.
|
||||
MT_Point3 temp = trans.getOrigin();
|
||||
m_cone_origin[0] = temp[0];
|
||||
m_cone_origin[1] = temp[1];
|
||||
m_cone_origin[2] = temp[2];
|
||||
|
||||
temp = trans(MT_Point3(0, -m_coneheight/2.0 ,0));
|
||||
m_cone_target[0] = temp[0];
|
||||
m_cone_target[1] = temp[1];
|
||||
m_cone_target[2] = temp[2];
|
||||
|
||||
|
||||
if (m_physCtrl)
|
||||
@@ -187,10 +197,58 @@ void KX_RadarSensor::SynchronizeTransform()
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* Python Functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
/* Integration hooks ------------------------------------------------------- */
|
||||
//Deprecated ----->
|
||||
/* getConeOrigin */
|
||||
const char KX_RadarSensor::GetConeOrigin_doc[] =
|
||||
"getConeOrigin()\n"
|
||||
"\tReturns the origin of the cone with which to test. The origin\n"
|
||||
"\tis in the middle of the cone.";
|
||||
PyObject* KX_RadarSensor::PyGetConeOrigin(PyObject* self) {
|
||||
ShowDeprecationWarning("getConeOrigin()", "the coneOrigin property");
|
||||
|
||||
PyObject *retVal = PyList_New(3);
|
||||
|
||||
PyList_SetItem(retVal, 0, PyFloat_FromDouble(m_cone_origin[0]));
|
||||
PyList_SetItem(retVal, 1, PyFloat_FromDouble(m_cone_origin[1]));
|
||||
PyList_SetItem(retVal, 2, PyFloat_FromDouble(m_cone_origin[2]));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/* getConeOrigin */
|
||||
const char KX_RadarSensor::GetConeTarget_doc[] =
|
||||
"getConeTarget()\n"
|
||||
"\tReturns the center of the bottom face of the cone with which to test.\n";
|
||||
PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self) {
|
||||
ShowDeprecationWarning("getConeTarget()", "the coneTarget property");
|
||||
|
||||
PyObject *retVal = PyList_New(3);
|
||||
|
||||
PyList_SetItem(retVal, 0, PyFloat_FromDouble(m_cone_target[0]));
|
||||
PyList_SetItem(retVal, 1, PyFloat_FromDouble(m_cone_target[1]));
|
||||
PyList_SetItem(retVal, 2, PyFloat_FromDouble(m_cone_target[2]));
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/* getConeHeight */
|
||||
const char KX_RadarSensor::GetConeHeight_doc[] =
|
||||
"getConeHeight()\n"
|
||||
"\tReturns the height of the cone with which to test.\n";
|
||||
PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self) {
|
||||
|
||||
ShowDeprecationWarning("getConeHeight()", "the distance property");
|
||||
|
||||
return PyFloat_FromDouble(m_coneheight);
|
||||
}
|
||||
//<----- Deprecated
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python Integration Hooks */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
PyTypeObject KX_RadarSensor::Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0,
|
||||
@@ -221,46 +279,39 @@ PyParentObject KX_RadarSensor::Parents[] = {
|
||||
};
|
||||
|
||||
PyMethodDef KX_RadarSensor::Methods[] = {
|
||||
//Deprecated ----->
|
||||
{"getConeOrigin", (PyCFunction) KX_RadarSensor::sPyGetConeOrigin,
|
||||
METH_NOARGS, (PY_METHODCHAR)GetConeOrigin_doc},
|
||||
METH_VARARGS, (PY_METHODCHAR)GetConeOrigin_doc},
|
||||
{"getConeTarget", (PyCFunction) KX_RadarSensor::sPyGetConeTarget,
|
||||
METH_NOARGS, (PY_METHODCHAR)GetConeTarget_doc},
|
||||
METH_VARARGS, (PY_METHODCHAR)GetConeTarget_doc},
|
||||
{"getConeHeight", (PyCFunction) KX_RadarSensor::sPyGetConeHeight,
|
||||
METH_NOARGS, (PY_METHODCHAR)GetConeHeight_doc},
|
||||
{NULL,NULL,NULL,NULL} //Sentinel
|
||||
METH_VARARGS, (PY_METHODCHAR)GetConeHeight_doc},
|
||||
//<-----
|
||||
{NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyAttributeDef KX_RadarSensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
KX_PYATTRIBUTE_FLOAT_ARRAY_RO("coneOrigin", KX_RadarSensor, m_cone_origin, 3),
|
||||
KX_PYATTRIBUTE_FLOAT_ARRAY_RO("coneTarget", KX_RadarSensor, m_cone_target, 3),
|
||||
KX_PYATTRIBUTE_FLOAT_RW("angle", 0, 360, KX_RadarSensor, m_coneradius),
|
||||
KX_PYATTRIBUTE_INT_RW("axis", 0, 5, true, KX_RadarSensor, m_axis),
|
||||
{NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyObject* KX_RadarSensor::_getattr(const char *attr) {
|
||||
_getattr_up(KX_TouchSensor);
|
||||
PyObject* KX_RadarSensor::_getattr(const char *attr)
|
||||
{
|
||||
PyObject* object = _getattr_self(Attributes, this, attr);
|
||||
if (object != NULL)
|
||||
return object;
|
||||
|
||||
_getattr_up(KX_NearSensor);
|
||||
}
|
||||
|
||||
/* getConeOrigin */
|
||||
const char KX_RadarSensor::GetConeOrigin_doc[] =
|
||||
"getConeOrigin()\n"
|
||||
"\tReturns the origin of the cone with which to test. The origin\n"
|
||||
"\tis in the middle of the cone.";
|
||||
PyObject* KX_RadarSensor::PyGetConeOrigin(PyObject* self) {
|
||||
return PyObjectFrom(m_cone_origin);
|
||||
int KX_RadarSensor::_setattr(const char *attr, PyObject* value)
|
||||
{
|
||||
int ret = _setattr_self(Attributes, this, attr, value);
|
||||
if (ret >= 0)
|
||||
return ret;
|
||||
|
||||
return KX_NearSensor::_setattr(attr, value);
|
||||
}
|
||||
|
||||
/* getConeOrigin */
|
||||
const char KX_RadarSensor::GetConeTarget_doc[] =
|
||||
"getConeTarget()\n"
|
||||
"\tReturns the center of the bottom face of the cone with which to test.\n";
|
||||
PyObject* KX_RadarSensor::PyGetConeTarget(PyObject* self) {
|
||||
return PyObjectFrom(m_cone_target);
|
||||
}
|
||||
|
||||
/* getConeOrigin */
|
||||
const char KX_RadarSensor::GetConeHeight_doc[] =
|
||||
"getConeHeight()\n"
|
||||
"\tReturns the height of the cone with which to test.\n";
|
||||
PyObject* KX_RadarSensor::PyGetConeHeight(PyObject* self) {
|
||||
return PyFloat_FromDouble(m_coneheight);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -40,23 +40,23 @@ class KX_RadarSensor : public KX_NearSensor
|
||||
protected:
|
||||
Py_Header;
|
||||
|
||||
MT_Scalar m_coneradius;
|
||||
float m_coneradius;
|
||||
|
||||
/**
|
||||
* Height of the cone.
|
||||
*/
|
||||
MT_Scalar m_coneheight;
|
||||
float m_coneheight;
|
||||
int m_axis;
|
||||
|
||||
/**
|
||||
* The previous position of the origin of the cone.
|
||||
*/
|
||||
MT_Point3 m_cone_origin;
|
||||
float m_cone_origin[3];
|
||||
|
||||
/**
|
||||
* The previous direction of the cone (origin to bottom plane).
|
||||
*/
|
||||
MT_Point3 m_cone_target;
|
||||
float m_cone_target[3];
|
||||
|
||||
public:
|
||||
|
||||
@@ -80,13 +80,23 @@ public:
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum RadarAxis {
|
||||
KX_RADAR_AXIS_POS_X = 0,
|
||||
KX_RADAR_AXIS_POS_Y,
|
||||
KX_RADAR_AXIS_POS_Z,
|
||||
KX_RADAR_AXIS_NEG_X,
|
||||
KX_RADAR_AXIS_NEG_Y,
|
||||
KX_RADAR_AXIS_NEG_Z
|
||||
};
|
||||
|
||||
virtual PyObject* _getattr(const char *attr);
|
||||
virtual int _setattr(const char *attr, PyObject* value);
|
||||
|
||||
//Deprecated ----->
|
||||
KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeOrigin);
|
||||
KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeTarget);
|
||||
KX_PYMETHOD_DOC_NOARGS(KX_RadarSensor,GetConeHeight);
|
||||
|
||||
//<-----
|
||||
};
|
||||
|
||||
#endif //__KX_RADAR_SENSOR_H
|
||||
|
@@ -269,6 +269,7 @@ PyParentObject KX_TouchSensor::Parents[] = {
|
||||
};
|
||||
|
||||
PyMethodDef KX_TouchSensor::Methods[] = {
|
||||
//Deprecated ----->
|
||||
{"setProperty",
|
||||
(PyCFunction) KX_TouchSensor::sPySetProperty, METH_O, (PY_METHODCHAR)SetProperty_doc},
|
||||
{"getProperty",
|
||||
@@ -277,12 +278,13 @@ PyMethodDef KX_TouchSensor::Methods[] = {
|
||||
(PyCFunction) KX_TouchSensor::sPyGetHitObject, METH_NOARGS, (PY_METHODCHAR)GetHitObject_doc},
|
||||
{"getHitObjectList",
|
||||
(PyCFunction) KX_TouchSensor::sPyGetHitObjectList, METH_NOARGS, (PY_METHODCHAR)GetHitObjectList_doc},
|
||||
//<-----
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
|
||||
PyAttributeDef KX_TouchSensor::Attributes[] = {
|
||||
KX_PYATTRIBUTE_STRING_RW("propertyName",0,100,false,KX_TouchSensor,m_touchedpropname),
|
||||
KX_PYATTRIBUTE_BOOL_RW("materialCheck",KX_TouchSensor,m_bFindMaterial),
|
||||
KX_PYATTRIBUTE_STRING_RW("property",0,100,false,KX_TouchSensor,m_touchedpropname),
|
||||
KX_PYATTRIBUTE_BOOL_RW("useMaterial",KX_TouchSensor,m_bFindMaterial),
|
||||
KX_PYATTRIBUTE_BOOL_RW("pulseCollisions",KX_TouchSensor,m_bTouchPulse),
|
||||
KX_PYATTRIBUTE_DUMMY("objectHit"),
|
||||
KX_PYATTRIBUTE_DUMMY("objectHitList"),
|
||||
@@ -372,6 +374,9 @@ PyObject* KX_TouchSensor::PyGetHitObjectList(PyObject* self)
|
||||
return m_colliders->AddRef();
|
||||
}
|
||||
|
||||
/*getTouchMaterial and setTouchMaterial were never added to the api,
|
||||
they can probably be removed with out anyone noticing*/
|
||||
|
||||
/* 5. getTouchMaterial */
|
||||
const char KX_TouchSensor::GetTouchMaterial_doc[] =
|
||||
"getTouchMaterial()\n"
|
||||
|
@@ -123,6 +123,7 @@ public:
|
||||
virtual PyObject* _getattr(const char *attr);
|
||||
virtual int _setattr(const char *attr, PyObject *value);
|
||||
|
||||
//Deprecated ----->
|
||||
/* 1. setProperty */
|
||||
KX_PYMETHOD_DOC_O(KX_TouchSensor,SetProperty);
|
||||
/* 2. getProperty */
|
||||
@@ -137,6 +138,7 @@ public:
|
||||
/* 6. setTouchMaterial */
|
||||
KX_PYMETHOD_DOC_O(KX_TouchSensor,SetTouchMaterial);
|
||||
#endif
|
||||
//<-----
|
||||
|
||||
};
|
||||
|
||||
|
@@ -140,6 +140,14 @@ Documentation for the GameLogic Module.
|
||||
@var KX_SOUNDACT_LOOPEND: See L{KX_SoundActuator}
|
||||
@var KX_SOUNDACT_LOOPBIDIRECTIONAL: See L{KX_SoundActuator}
|
||||
@var KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: See L{KX_SoundActuator}
|
||||
|
||||
@group Radar Sensor: KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z, KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
|
||||
@var KX_RADAR_AXIS_POS_X: See L{KX_RadarSensor}
|
||||
@var KX_RADAR_AXIS_POS_Y: See L{KX_RadarSensor}
|
||||
@var KX_RADAR_AXIS_POS_Z: See L{KX_RadarSensor}
|
||||
@var KX_RADAR_AXIS_NEG_X: See L{KX_RadarSensor}
|
||||
@var KX_RADAR_AXIS_NEG_Y: See L{KX_RadarSensor}
|
||||
@var KX_RADAR_AXIS_NEG_Z: See L{KX_RadarSensor}
|
||||
"""
|
||||
|
||||
|
||||
|
@@ -5,5 +5,10 @@ from KX_TouchSensor import *
|
||||
class KX_NearSensor(KX_TouchSensor):
|
||||
"""
|
||||
A near sensor is a specialised form of touch sensor.
|
||||
|
||||
@ivar distance: The near sensor activates when an object is within this distance.
|
||||
@type distance: float
|
||||
@ivar resetDistance: The near sensor deactivates when the object exceeds this distance.
|
||||
@type resetDistance: float
|
||||
"""
|
||||
|
||||
|
@@ -5,8 +5,26 @@ from KX_NearSensor import *
|
||||
class KX_RadarSensor(KX_NearSensor):
|
||||
"""
|
||||
Radar sensor is a near sensor with a conical sensor object.
|
||||
|
||||
@ivar coneOrigin: The origin of the cone with which to test. The origin
|
||||
is in the middle of the cone.
|
||||
(Read only)
|
||||
@type coneOrigin: list of floats [x, y, z]
|
||||
@ivar coneTarget: The center of the bottom face of the cone with which to test.
|
||||
(Read only)
|
||||
@type coneTarget: list of floats [x, y, z]
|
||||
@ivar distance: The height of the cone with which to test.
|
||||
@type distance: float
|
||||
@ivar angle: The angle of the cone (in degrees) with which to test.
|
||||
@type angle: float from 0 to 360
|
||||
@ivar axis: The axis on which the radar cone is cast
|
||||
@type axis: int from 0 to 5
|
||||
KX_RADAR_AXIS_POS_X, KX_RADAR_AXIS_POS_Y, KX_RADAR_AXIS_POS_Z,
|
||||
KX_RADAR_AXIS_NEG_X, KX_RADAR_AXIS_NEG_Y, KX_RADAR_AXIS_NEG_Z
|
||||
"""
|
||||
|
||||
|
||||
#--The following methods are deprecated, please use properties instead.
|
||||
def getConeOrigin():
|
||||
"""
|
||||
Returns the origin of the cone with which to test. The origin
|
||||
|
@@ -70,3 +70,16 @@ class KX_Scene:
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def addObject(object, other, time=0)
|
||||
"""
|
||||
Adds an object to the scene like the Add Object Actuator would, and returns the created object.
|
||||
|
||||
@param object: The object to add
|
||||
@type object: L{KX_GameObject} or string
|
||||
@param other: The object's center to use when adding the object
|
||||
@type other: L{KX_GameObject} or string
|
||||
@param time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
|
||||
@type time: int
|
||||
|
||||
@rtype: L{KX_GameObject}
|
||||
"""
|
||||
|
@@ -7,10 +7,11 @@ class KX_TouchSensor(SCA_ISensor):
|
||||
"""
|
||||
Touch sensor detects collisions between objects.
|
||||
|
||||
@ivar propertyName: The name of the property or material this sensor detects (depending on the materialCheck property).
|
||||
@type propertyName: string
|
||||
@ivar materialCheck: when enabled this sensor checks for object materials rather then properties.
|
||||
@type materialCheck: bool
|
||||
@ivar property: The property or material to collide with.
|
||||
@type property: string
|
||||
@ivar useMaterial: Determines if the sensor is looking for a property or material.
|
||||
KX_True = Find material; KX_False = Find property
|
||||
@type useMaterial: boolean
|
||||
@ivar pulseCollisions: The last collided object.
|
||||
@type pulseCollisions: bool
|
||||
@ivar objectHit: The last collided object. (Read Only)
|
||||
@@ -18,24 +19,26 @@ class KX_TouchSensor(SCA_ISensor):
|
||||
@ivar objectHitList: A list of colliding objects. (Read Only)
|
||||
@type objectHitList: list
|
||||
"""
|
||||
|
||||
#--The following methods are deprecated, please use properties instead.
|
||||
def setProperty(name):
|
||||
"""
|
||||
DEPRECATED: use the propertyName property
|
||||
DEPRECATED: use the property property
|
||||
Set the property or material to collide with. Use
|
||||
setTouchMaterial() to switch between properties and
|
||||
materials.
|
||||
@type name: string
|
||||
"""
|
||||
|
||||
def getProperty():
|
||||
"""
|
||||
DEPRECATED: use the propertyName property
|
||||
DEPRECATED: use the property property
|
||||
Returns the property or material to collide with. Use
|
||||
getTouchMaterial() to find out whether this sensor
|
||||
looks for properties or materials. (B{deprecated})
|
||||
|
||||
@rtype: string
|
||||
"""
|
||||
|
||||
def getHitObject():
|
||||
"""
|
||||
DEPRECATED: use the objectHit property
|
||||
@@ -54,7 +57,7 @@ class KX_TouchSensor(SCA_ISensor):
|
||||
"""
|
||||
def getTouchMaterial():
|
||||
"""
|
||||
DEPRECATED: use the materialCheck property
|
||||
DEPRECATED: use the useMaterial property
|
||||
Returns KX_TRUE if this sensor looks for a specific material,
|
||||
KX_FALSE if it looks for a specific property. (B{deprecated})
|
||||
"""
|
||||
|
Reference in New Issue
Block a user