Radar Sensor: propName

propName
  • gets/sets the name of the property that the radar looks for
     
  • Radar Sensor name:  Property

Type: 
  • string
Radar Sensor:
  • Game object being detected must have Actor enabled.
Properties menu >> Physics button >> Physics Type >> Actor checkbox
  • Radar Sensor is triggered when the first game object is detected.
  • Radar 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 radar 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 Search

sen = cont.sensors["Search"]

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


################  Set the name of the property that the radar 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 Search

sen = cont.sensors["Search"]

# Set the name of the property
# property name is enemy

sen.propName = "enemy"