- Home /
Rendertexture raycast
Hey guys,
Just wondering if it is possible to do a raycast when a mouse button is pressed and detect collisions on a rendertexture on a plane. I have two cameras in my scene. Camera 1 is an orthogonal camera which is looking at objects with collision boxes. Camera 2 is a perspective camera looking at a plane, which has Camera 1's data rendered onto it.
When i click i want to click on the plane and then interact with the objects from Camera 1.
Thanks
Have you found any solution to this (except recomputing the point to an actual new raycast in the camera view)?
you can cast the ray from any camera. using Camera.ScreenPointToRay() using whichever camera you want to cast from.
However i have a similar setup to the one you described, but i find that even though the orthogonal plane render and the old camera render line up in terms of screen positions, the raycasting is not consistent when displaying the screen from the orthogonal camera.