distance
distance
gets/sets the distance that triggers the Near Sensor when an object
approaches.
Type: float
Sample
Code
################# Get distance
# get the controller
controller = GameLogic.getCurrentController()
# get the near sensor connected to the controller
named sensor
alarm = controller.sensors["sensor"]
# get distance
dist = alarm.distance
################# Set distance
# get the controller
controller = GameLogic.getCurrentController()
# get the near sensor connected to the controller
named sensor
alarm = controller.sensors["sensor"]
# set distance
alarm.distance = 2.0
|