Ray Sensor: useXRay

useXRay
  • gets/sets if sensor is using X-Ray Mode
  • Ray Sensor name:  X-Ray Mode

Type: 
  • boolean

Values:

  • 1 = True = using X-Ray Mode
  • 0 = False = not using X-Ray Mode
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


################  Using X-Ray Mode?

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

# Using X-Ray Mode?
xRay = sen.useXRay
 
Sample Code


################  Set Ray sensor to use X-Ray Mode

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

# use X-Ray Mode
sen.useXRay = True