- Home /
Plane inclinated width projection
Hi everybody!.
I've a problem in Unity.
I've a plane inclined of a certain degree (say 60 degree). I would like to compute what is the projected width occupied by the plane.
I'll try to explane better. When plane is 90 degree inclinated is perpendicular to the bottom. So is projected width is 0 (or at most 1).
When the plane is 60 degree inclined, its projected width should be cos(60) * plane.height = 1/2.
However i don't know how is the correct way to do this in Unity: compute the projection via Script.
Can you help me, please? Thanks.
Answer by Jesse Anders · May 07, 2011 at 04:05 PM
Strictly speaking, the 1-d projection of a plane is either zero (if the axis onto which the plane is projected is parallel to the plane normal), or infinite.
However, Unity somewhat liberally uses the term 'plane' to refer to a rectangle, which I assume is what you're referring to here.
Have you tried cos(angle) * plane_height? Unless I'm missing something, that should give you the value you're looking for.
$$anonymous$$athf
has the trig functions. The width is probably going to be the collider width: transform.GetComponent<BoxCollider>().size.x
(C#) A hack is you could child an empty to the tilted end and just read the position -- let Unity do the math: transform.Find("endP").position.x - transform.position.x
So now my question is: How can i access to the plane height and width; $$anonymous$$y Plane does not have a Box collider attached. Only a $$anonymous$$esh Collider.
So, the mesh collider is because it has humps on top? You could look at compound colliders http://unity3d.com/support/documentation/Components/class-BoxCollider.html. For a $$anonymous$$eshCollider, can look at bounds (but only if not rotated) or search through the vert array for highest x/z http://unity3d.com/support/documentation/ScriptReference/$$anonymous$$esh.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613132407im_/https://answers.unity.com/themes/thub/images/avi.jpg)