*.getHitObject() problems....


(Krabat) #1

Hoi everyone,

getting desperate with a python script linked to a ray sensor to find out where and what i hit when a submarine fires a shot. :x
the ray is triggered by objects with a property, axxis is okay too. i’ll just write down the py-script:

Sensor = c.getSensors()[0]
Where = Sensor.getHitPosition() #this works fine
How = Sensor.getHitOrientation() #no problems either
What = Sensor.getHitObject() #gives back an empty string or “None”

The object the ray hits is directly infront of the ray sensor, named and has the right property set. Software is Blender Publisher.

What am I doing wrong… help

Krabat


(Yamyam) #2

Do you print the object name with “print What.getName()”?


(Krabat) #3

No i don’t, i just “print What”…
Thanks you for your help, i’ll try it right away with “print What.getName()”!

bows
Krabat


(Krabat) #4

Yes, it works! i get “None” or the object’s name, for example “OBTunnel”. This problem was letting my project coming to a complete halt, now i can continue blending.

Thanks a lot!

bows again

Krabat