Need help about collision sensor ...

(sjinny) #1

i found the radar sensor is broken so i tried to replace it with a invisible mesh & collision sensor.
i need the “radar” mesh to be a child of an empty object and it has some more child mesh es which defines it’s collision shape so the “Compound” button is pushed down.
the problem is :
when the empty object’s “Compound” button is pushed down, the python script of “radar” mesh which is the child of the empty can’t get the sensor :
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “Radar.py”, line 5, in <module>
AttributeError: Unable to find requested sensor

how to solve this ?

0 Likes

(Stu_Flowers) #2

You have to define the sensor before the script can recognize it. Here’s an example:

 cont = GameLogic.getCurrentController()
my_sensor  = cont.getSensor("the_sensor_name")

Then hook the sensor into the script controller. I hope that is what you were asking…?

~~Stu

0 Likes