rayCast doesn't work in background scene?


I’m trying to use rayCast in a Python script to detect objects in a world scene from a script in an overlay scene. That is, the script is running from a different scene from the one I’m trying to detect objects in.

… And this never detects any objects for some reason. The same rayCast script works fine when I run it from within the same scene, but never from the overlay scene. I know that it is specifically the rayCast function that is failing, since the rest of the script is running just as predicted. (I want to run the script from the overlay HUD scene so that each world scene can be controlled from the HUD.)

Any ideas as to how to work around this?

I can post an example .blend file if the problem isn’t clear.

You can’t detect a ray from and overlay scene to your scene because its just rendered on top, its not physically there.

Actually, I think I reported a bug about this some time ago. Ray cast function calls don’t work across scenes (i.e. you can’t grab an object in another scene and cast a ray to somewhere else in its scene; it will act like it’s all in the current main scene). The only real workaround is to call the ray cast function from that other scene, if I recall correctly.

Alright, Josip and SolarLune, thanks. Hopefully this bug gets addressed fairly soon. In the meantime, I’ll try putting this part of the script inside the background scene.