Module KX_TouchSensor :: Class KX_TouchSensor

Class KX_TouchSensor

source code

SCA_ILogicBrick.SCA_ILogicBrick --+    
                                  |    
            SCA_ISensor.SCA_ISensor --+
                                      |
                                     KX_TouchSensor
Known Subclasses:
KX_NearSensor.KX_NearSensor

Touch sensor detects collisions between objects.

Instance Methods
 
setProperty(name)
Set the property or material to collide with.
source code
string
getProperty()
Returns the property or material to collide with.
source code
KX_GameObject
getHitObject()
Returns the last object hit by this touch sensor.
source code
list [KX_GameObject]
getHitObjectList()
Returns a list of all objects hit in the last frame.
source code
 
getTouchMaterial()
Returns KX_TRUE if this sensor looks for a specific material, KX_FALSE if it looks for a specific property.
source code
 
setTouchMaterial(flag)
Set flag to KX_TRUE to switch on positive pulse mode, KX_FALSE to switch off positive pulse mode.
source code

Inherited from SCA_ISensor.SCA_ISensor: getFrequency, getInvert, getUseNegPulseMode, getUsePosPulseMode, isPositive, setFrequency, setInvert, setUseNegPulseMode, setUsePosPulseMode

Inherited from SCA_ILogicBrick.SCA_ILogicBrick: getExecutePriority, getOwner, setExecutePriority

Method Details

setProperty(name)

source code 
Set the property or material to collide with. Use setTouchMaterial() to switch between properties and materials.

getProperty()

source code 
Returns the property or material to collide with. Use getTouchMaterial() to find out whether this sensor looks for properties or materials.
Returns: string

getHitObjectList()

source code 

Returns a list of all objects hit in the last frame.

Only objects that have the requisite material/property are listed.
Returns: list [KX_GameObject]

setTouchMaterial(flag)

source code 
Set flag to KX_TRUE to switch on positive pulse mode, KX_FALSE to switch off positive pulse mode.