🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How does Unitys Vector3.ProjectOnPlane() work?

Started by
3 comments, last by Alberth 4 years, 8 months ago

I cant get myself to figure out how ProjectOnPlane works. The documentation shows an image which unfortunately is in 2d. I think the image does what i thought Vector3.Project() does.

I understand that the plane which is spanned by "planeNormal" always goes trough the origin. However i think there are infinite solutions for the plane since in 3d it can be twisted(rotated) in any way.

Unitys Vector3.ProjectOnPlane documentation:

https://docs.unity3d.com/ScriptReference/Vector3.ProjectOnPlane.html?_ga=2.266340619.482046314.1571909813-981268087.1571412926

*Update

I think i understand it a little bit better now, i didn't know "planeNormal" referenced "normal vector" which is a mathematically term. So the plane is orthogonal to the "planeNormal"?

 

Thanks for any help in advance!

Advertisement

It might just be me, but the documentation for ProjectOnPlane() seems a little confusing. In any case:

Quote

I think the image does what i thought Vector3.Project() does.

As you're probably aware now, Project() projects one vector onto another, whereas ProjectOnPlane() projects a point onto a plane (presumably).

Quote

I understand that the plane which is spanned by "planeNormal" always goes trough the origin.

That appears to be the case.

Quote

However i think there are infinite solutions for the plane since in 3d it can be twisted(rotated) in any way.

I'm not sure what you mean by infinite solutions. There's an infinite number of (hyper)planes passing through the origin in both 2-d and 3-d. The projection however should always have a unique solution.

Quote

So the plane is orthogonal to the "planeNormal"?

Yes, theoretically at least (but again, I'm a little confused by the Unity documentation).

Thanks, i understood it now. It was actually quite easy, the documentation is just really confusing.

Vector3.ProjectOnPlane() takes two arguments, the first argument is the normal vector which defines the plane, which will be orthogonal on both axis to the vector. It then projects the vector from the second argument onto the plane.

This can be closed. Im new here and don't see an option to do that.

Topics don't get closed here, people simply stop posting and the thread disappears from the top of the list.

This topic is closed to new replies.

Advertisement