适用于场景视图样式 3D GUI 的 Helper 函数。
这些主要是帮助在 3D 场景空间和 2D GUI 之间进行转换的数学函数。这些函数可用于构造 Unity 编辑器本身,因此使用这些函数有利于确保您自己的 Handle GUI 与 Unity 的保持一致。
acceleration | 获取用于拖动值的标准加速度(只读)。 |
niceMouseDelta | 获取用于拖动浮点值的精密鼠标增量(只读)。 |
niceMouseDeltaZoom | 获取用于缩放的精密鼠标增量(只读)。 |
AddControl | 记录从手柄到测量点的距离。 |
AddDefaultControl | 为默认控件添加 ID。如果没有其他控件可选,则选择此控件。 |
CalcLineTranslation | 将鼠标拖动映射到沿 3D 空间中一条直线的运动。 |
ClosestPointToArc | 获取弧线(在 3D 空间中)上最接近当前鼠标位置的点。 |
ClosestPointToDisc | 获取圆盘(在 3D 空间中)上最接近当前鼠标位置的点。 |
ClosestPointToPolyLine | 获取折线(在 3D 空间中)上最接近当前鼠标位置的点。 |
DistancePointBezier | 计算点与贝塞尔曲线之间的距离。 |
DistancePointLine | 计算点与线之间的距离。 |
DistancePointToLine | 从 2d 中的一个点 p 到由两个点 a 和 b 定义的一条直线的距离。 |
DistancePointToLineSegment | 从 2d 中的一个点 p 到由两个点 a 和 b 定义的线段的距离。 |
DistanceToArc | 从鼠标指针到 3D 圆扇形的像素距离。 |
DistanceToCircle | 从鼠标指针到朝向摄像机的圆形的像素距离。 |
DistanceToDisc | 从鼠标指针到 3D 圆盘的像素距离。 |
DistanceToLine | 从鼠标指针到直线的像素距离。 |
DistanceToPolyLine | 从鼠标指针到折线的像素距离。 |
DistanceToRectangle | 从鼠标指针到屏幕上一个矩形的像素距离。 |
GetHandleSize | 获取给定位置处操控器手柄的世界空间大小。 |
GUIPointToScreenPixelCoordinate | 将 2D GUI 位置转换为屏幕像素坐标。 |
GUIPointToWorldRay | 将 2D GUI 位置转换为世界空间射线。 |
PickGameObject | 选择最接近指定位置的游戏对象。 |
PickRectObjects | 选择位于指定屏幕矩形内的游戏对象。 |
PlaceObject | Casts a ray against the loaded scenes and returns the nearest intersected point on a collider. |
PointOnLineParameter | 返回给定线上 point 投影的参数。 |
PopCamera | 检索所有摄像机设置。 |
ProjectPointLine | 将 point 投射到一条直线上。 |
PushCamera | 存储所有摄像机设置。 |
RaySnap | 如果对象位于自身路径中,则向场景投射 /ray/。 |
Repaint | 重新绘制当前视图。 |
WorldPointToSizedRect | 计算一个用于在 3D 空间中投影点附近显示 2D GUI 元素的矩形。 |
WorldToGUIPoint | 将世界空间点转换为 2D GUI 位置。 |
WorldToGUIPointWithDepth | 将世界空间点转换为 2D GUI 位置。 |
placeObjectCustomPasses | Subscribe to this event to handle object placement in the SceneView. |
PlaceObjectDelegate | This is the method definition for placeObjectCustomPasses. |
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.