平面在 3D 空间中的表示。
平面是无限大的平坦表面,存在于 3D 空间中,将空间划分为两半(称为半空间)。可方便地确定特定点处于两个半空间的哪一个中,以及确定该点与平面相距多远。墙壁、地板和其他平坦表面在游戏中十分常见,因此平面有时可用于包含这些对象的数学计算。此外,在某些情况下真实表面并不存在,但是假设存在一个表面会十分有用。例如在运动中,球门线或边线通常被假设为延伸到空中,从而实际上定义了一个平面。
当平面穿过世界空间中的 <0,0,0> 点时,只需通过确定其朝向的法线矢量即可定义。如果您想象从侧面看着平面,则很容易明白。
请注意,法线矢量源自哪一侧十分重要,因为它用于标识某个点所处的半空间(即,处于平面的正或“法线”侧,或是另一侧)。当平面不穿过 <0,0,0> 时,可以通过法线矢量以及相对于 <0,0,0> 的距离进行定义。
平面还可以通过位于平面中的三角形的三个顶点来定义。在这种情况下,如果在您看着正面朝上的三角形时,角点呈顺时针顺序,则法线矢量指向您。。
distance | The distance measured from the Plane to the origin, along the Plane's normal. |
flipped | 返回朝向相反方向的平面副本。 |
normal | 平面的法线矢量。 |
Plane | 创建平面。 |
ClosestPointOnPlane | 对于给定 /point/,返回平面上的最近点。 |
Flip | 使平面朝向相反方向。 |
GetDistanceToPoint | 返回从平面到点的带符号距离。 |
GetSide | 点是否处于平面的正向侧? |
Raycast | 使射线与平面相交。 |
SameSide | 两个点是否处于平面的相同侧? |
Set3Points | 使用位于其中的三个点设置平面。在您向下看着平面的上表面时,这些点呈顺时针顺序。 |
SetNormalAndPosition | 使用位于其中的一个点设置平面,该点沿着法线以便确定其方向。 |
Translate | 返回按给定 translation 在空间中移动的给定平面副本。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.