- Home /
Intersection point of mouse with ZX plane
I have
worldRay = HandleUtility.GUIPointToWorldRay(current.mousePosition);
On my OnSceneGUI function. How can I get the intersection point of the mouse with the ZX plane? The plane isn't there, it extends virtually to the infinite.
I tried
worldRay.GetPoint(0f);
And it works great if I use the Top camera, but if I move the camera a little the value is inconsistent.
Comment
Best Answer
Answer by Veehmot · Nov 01, 2011 at 02:35 PM
Found out:
float enter;
Plane xz = new Plane(new Vector3(0f, 1f, 0f), 0f);
xz.Raycast(worldRay, out enter);
worldRay.GetPoint(enter);