x


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.

more ▼

asked Nov 01 '11 at 02:27 PM

Veehmot gravatar image

Veehmot
376 14 18 25

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Found out:

float enter;
Plane xz = new Plane(new Vector3(0f, 1f, 0f), 0f);
xz.Raycast(worldRay, out enter);
worldRay.GetPoint(enter);
more ▼

answered Nov 01 '11 at 02:35 PM

Veehmot gravatar image

Veehmot
376 14 18 25

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1535
x985
x253
x25

asked: Nov 01 '11 at 02:27 PM

Seen: 1186 times

Last Updated: Nov 01 '11 at 02:48 PM