Radar sensor

The radar sensor works like the near sensor but only withing the sight of an imaginary cone set on a specific axis, with a specific angle and distance . It sends a positive pulse when an object (with the option "actor" enabled 1) is in the cone's domain, but any more objects won't trigger another pulse.
The sensor will be reset when all objects are no longer detected (no longer in the cone's domain)

Option(s) of the Radar sensor :

  • Property :
    • Only objects with Actor enabled with this Property will trigger/reset the Radar sensor
    • Leave blank to react to all objects with Actor enabled
  • Distance : Length of the radar Cone 2
  • Angle : Opening angle of the radar Cone
  • Axis : Direction the radar Cone is pointing to
  • Common options of all Sensors

Python :

# import bge module
import bge
 
# get the controller
cont = bge.logic.getCurrentController()
 
# get the sensor attached to the controller
# my sensor is named Trigger
sen = cont.sensors["Trigger"]
  • sen.distance : Returns the maximum radar detection distance ( float / 0 to 10,000.00 )
  • sen.angle : Returns the angle of the radar cone ( float / 0 to 179.9 ? )
  • sen.axis : Get/set the game object axis the radar cone uses ( integer / +X,+Y,+Z,-X,-Y,-Z = 0,1,2,3,4,5 )
  • sen.coneOrigin : Returns the world position of the origin of the radar detection cone ( float / x,y,z )
  • sen.hitObject : Returns the last game object hit . Returns "None" if no objects are detected
  • sen.hitObjectList : Returns a list of the objects hit in the last frame
  • sen.propName : gets/sets the name of the property that the near sensor looks for

Note:

  1. Only detects game objects that have Actor enabled. ( Properties menu » Physics button » Physics tab » Actor)
  2. Radar Sensor can't be blocked. Sees through walls etc.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License