HandleUtility.ClosestPointToPolyLine

매뉴얼로 전환
public static Vector3 ClosestPointToPolyLine (params Vector3[] vertices);

설명

Get the point on a polyline (in 3D space) which is closest to the current mouse position.

A polyline is simply a zigzag line defined by a set of points connected in sequence. The ClosestPointToPolyLine function takes the polyline defined by a point array and "flattens" it into screen space. The closest point between the flattened line and the current mouse position (also in screen space) is then found and converted back into a 3D point on the original 3D polyline. This is useful for Handle GUIs that involve manipulating an arbitrary 3D shape using the mouse; the 2D mouse movements are converted into 3D space in the familiar way used by Unity's built-in tools. An example of where this might be used is a racetrack defined by a set of waypoints - a position along the track line could be selected via the mouse using ClosestPointToPolyLine.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961