2004-05-30 11:09:46 +00:00
|
|
|
# $Id$
|
2004-05-24 07:49:50 +00:00
|
|
|
# Documentation for KX_TouchSensor
|
|
|
|
from SCA_ISensor import *
|
2009-02-26 04:17:23 +00:00
|
|
|
from KX_GameObject import *
|
2004-05-24 07:49:50 +00:00
|
|
|
|
|
|
|
class KX_TouchSensor(SCA_ISensor):
|
|
|
|
"""
|
|
|
|
Touch sensor detects collisions between objects.
|
2009-02-26 04:17:23 +00:00
|
|
|
|
2009-02-28 21:00:27 +00:00
|
|
|
@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
|
2009-02-26 04:17:23 +00:00
|
|
|
@ivar pulseCollisions: The last collided object.
|
|
|
|
@type pulseCollisions: bool
|
|
|
|
@ivar objectHit: The last collided object. (Read Only)
|
|
|
|
@type objectHit: L{KX_GameObject} or None
|
|
|
|
@ivar objectHitList: A list of colliding objects. (Read Only)
|
2009-04-20 15:06:46 +00:00
|
|
|
@type objectHitList: L{CListValue<CListValue.CListValue>} of L{KX_GameObject<KX_GameObject.KX_GameObject>}
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
2009-02-28 21:00:27 +00:00
|
|
|
|
|
|
|
#--The following methods are deprecated, please use properties instead.
|
2004-05-24 07:49:50 +00:00
|
|
|
def setProperty(name):
|
|
|
|
"""
|
2009-02-28 21:00:27 +00:00
|
|
|
DEPRECATED: use the property property
|
2004-05-24 07:49:50 +00:00
|
|
|
Set the property or material to collide with. Use
|
|
|
|
setTouchMaterial() to switch between properties and
|
|
|
|
materials.
|
|
|
|
@type name: string
|
|
|
|
"""
|
2009-02-28 21:00:27 +00:00
|
|
|
|
2004-05-24 07:49:50 +00:00
|
|
|
def getProperty():
|
|
|
|
"""
|
2009-02-28 21:00:27 +00:00
|
|
|
DEPRECATED: use the property property
|
2004-05-24 07:49:50 +00:00
|
|
|
Returns the property or material to collide with. Use
|
|
|
|
getTouchMaterial() to find out whether this sensor
|
2009-02-26 04:17:23 +00:00
|
|
|
looks for properties or materials. (B{deprecated})
|
2004-05-24 07:49:50 +00:00
|
|
|
|
|
|
|
@rtype: string
|
|
|
|
"""
|
|
|
|
def getHitObject():
|
|
|
|
"""
|
2009-02-26 04:17:23 +00:00
|
|
|
DEPRECATED: use the objectHit property
|
|
|
|
Returns the last object hit by this touch sensor. (B{deprecated})
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-06-02 12:43:27 +00:00
|
|
|
@rtype: L{KX_GameObject}
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
def getHitObjectList():
|
|
|
|
"""
|
2009-02-26 04:17:23 +00:00
|
|
|
DEPRECATED: use the objectHitList property
|
|
|
|
Returns a list of all objects hit in the last frame. (B{deprecated})
|
2004-05-24 07:49:50 +00:00
|
|
|
|
|
|
|
Only objects that have the requisite material/property are listed.
|
|
|
|
|
2009-04-20 15:06:46 +00:00
|
|
|
@rtype: L{CListValue<CListValue.CListValue>} of L{KX_GameObject<KX_GameObject.KX_GameObject>}
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
def getTouchMaterial():
|
|
|
|
"""
|
2009-02-28 21:00:27 +00:00
|
|
|
DEPRECATED: use the useMaterial property
|
2004-05-24 07:49:50 +00:00
|
|
|
Returns KX_TRUE if this sensor looks for a specific material,
|
2009-02-26 04:17:23 +00:00
|
|
|
KX_FALSE if it looks for a specific property. (B{deprecated})
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|