Ray Sensor: useMaterial

useMaterial
  • gets/sets if sensor is looking for a Material or a Property

Type: 
  • boolean

Values:

  • 1 = True = Looking for a Material
     
  • 0 = False = Looking for a Property
Ray Sensor:
  • Ray Sensor is triggered when the first game object is detected.
  • Ray Sensor is reset when all game objects are no longer detected.
  • Triggered:  One positive pulse is sent to the connected controller(s).
  • Reset:  One negative pulse is sent to the connected controller(s).
Sample Code


################  Ray sensor looking for a material or a property?

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# my sensor is named Tripwire

sen = cont.sensors["Tripwire"]

# looking for a material or a property?
status = sen.useMaterial
 
Sample Code


################  Set Ray sensor to look for a property

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the sensor attached to the controller
# sensor is named Tripwire

sen = cont.sensors["Tripwire"]

# set ray sensor to look for a property
sen.useMaterial = 0