Ray Sensor: propName

propName
  • gets/sets the name of the property that the ray looks for
     
  • Ray Sensor name:  Property

Type: 
  • string
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


################  Get the name of the property that the ray looks for.

# 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"]

# get the name of the property
name = sen.propName
 
Sample Code


################  Set the name of the property that the ray looks for.

# 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"]

# set the name of the property
sen.propName = "enemy"