Allow ray to see through properties? Here is my code:

import bge
from bge import logic

controllor = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()

target = scene.objects['Target']
ray = controllor.sensors['Ray']

if (ray.hitObject and not 'Fire_False' in ray.hitObject):
    target.worldPosition = ray.hitPosition


I've noticed that if you have an object with the prop "Fire_False" and an object behind it without the prop, the ray doesn't track to the object behind the first. I am looking to modify this script so the ray can look through the object with the prop and find other objects behind it. If the script sees a situation like this, it uses the object with the prop as a dead end, and does not continue tracking. How can I have this ray see though props? Any help is appreciated. Thanks!

EDIT: I would also like this to work if an object in in another object and the bound object does have Fire_False, but the object in it doesn't.
You are thinking of this backwards from how the ray sensor works. You want to look for "target" no mater what is in front of it.

Add a property to everything you want to get hit say "target". Then change the ray senor to look only for that property ("target") and enable X-Ray Mode.


Last your code can then look like this.

if ray.hitObject:
    target.worldPosition = ray.hitPosition


X-Ray Mode will let the ray look through everything, and the property will only return the objects with the property "target."