I’m writing a script, and I’m trying to use getHitObjectList() from a radar sensor, but it’s only returning a empty array. Do you have any Idea why this might be, or how to fix it?
Hi, if you are using Blender 2.49b try this:
1 Cube with a Radar Sensor and 4 Cubes and an Empty on a side (Cubes parented with the empty with a 10 units distance from de single cube, the cubes forming a cross a round the empty) select the proper axis in the radar sensor an set the angle to 45 and the distance to 5, make the empty spin with a simple: always->and->motion(0.0,0.0,0.3) on the logic bricks.
Use this script on the single cube with the sensor…
Get Game Logic
import GameLogic as gl
ctrl=gl.getCurrentController()
scn=gl.getCurrentScene()
Get Sensor
rdr=ctrl.sensors[“Radar”]
lst=rdr.hitObjectList
Get Sensor Activation and Print the list
if rdr.positive==True:
print (lst)
else:
print (“None”)
don’t forget to activate the actor button in the logic area for the 4 cubes (one by one).
Ooops! almost forgot, the distance between the cubes from the empty are 5 units.