C# Класс UnityEditor.HandleUtility

Helper functions for Scene View style 3D GUI.

Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
ApplyDottedWireMaterial void
ApplyWireMaterial void
BeginHandles void
CalcRayPlaceOffset float
CameraNeedsToRenderIntoRT bool
DistanceToDiamond float
DistanceToDiamondInternal float
DistanceToRectangleInternal float
EndHandles void
FindNearestVertex bool
FindSelectionBase UnityEngine.GameObject
GetParametrization float
INTERNAL_CALL_CalcRayPlaceOffset float
INTERNAL_CALL_DistancePointBezier float
INTERNAL_CALL_Internal_FindNearestVertex bool
INTERNAL_CALL_Internal_PickClosestGO UnityEngine.GameObject
INTERNAL_CALL_Internal_PickRectObjects UnityEngine.GameObject[]
INTERNAL_CALL_IntersectRayMesh bool
InitHandleMaterials void
Internal_FindNearestVertex bool
Internal_PickClosestGO UnityEngine.GameObject
Internal_PickRectObjects UnityEngine.GameObject[]
Internal_Repaint void
Internal_SetHandleWireTextureIndex void
IntersectRayMesh bool
PickGameObject UnityEngine.GameObject
PickGameObject UnityEngine.GameObject
SetViewInfo void

Открытые методы

Метод Описание
AddControl ( int controlId, float distance ) : void

Record a distance measurement from a handle.

AddDefaultControl ( int controlId ) : void

Add the ID for a default control. This will be picked if nothing else is.

CalcLineTranslation ( Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir ) : float

Map a mouse drag onto a movement along a line in 3D space.

ClosestPointToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : Vector3

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

ClosestPointToDisc ( Vector3 center, Vector3 normal, float radius ) : Vector3

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

ClosestPointToPolyLine ( ) : Vector3

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

DistancePointBezier ( Vector3 point, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : float

Calculate distance between a point and a Bezier curve.

DistancePointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float

Calculate distance between a point and a line.

DistancePointToLine ( Vector2 p, Vector2 a, Vector2 b ) : float

Distance from a point p in 2d to a line defined by two points a and b.

DistancePointToLineSegment ( Vector2 p, Vector2 a, Vector2 b ) : float

Distance from a point p in 2d to a line segment defined by two points a and b.

DistanceToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : float

Pixel distance from mouse pointer to a 3D section of a disc.

DistanceToCircle ( Vector3 position, float radius ) : float

Pixel distance from mouse pointer to camera facing circle.

DistanceToDisc ( Vector3 center, Vector3 normal, float radius ) : float

Pixel distance from mouse pointer to a 3D disc.

DistanceToLine ( Vector3 p1, Vector3 p2 ) : float

Pixel distance from mouse pointer to line.

DistanceToPolyLine ( ) : float

Pixel distance from mouse pointer to a polyline.

DistanceToRectangle ( Vector3 position, Quaternion rotation, float size ) : float

Pixel distance from mouse pointer to a rectangle on screen.

GUIPointToWorldRay ( Vector2 position ) : Ray

Convert 2D GUI position to a world space ray.

GetHandleSize ( Vector3 position ) : float

Get world space size of a manipulator handle at given position.

PickGameObject ( Vector2 position, GameObject ignore, int &materialIndex ) : GameObject
PickGameObject ( Vector2 position, bool selectPrefabRoot ) : GameObject

Pick game object closest to specified position.

PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore ) : GameObject
PickGameObject ( Vector2 position, int &materialIndex ) : GameObject
PickRectObjects ( Rect rect ) : UnityEngine.GameObject[]

Pick GameObjects that lie within a specified screen rectangle.

PickRectObjects ( Rect rect, bool selectPrefabRootsOnly ) : UnityEngine.GameObject[]

PointOnLineParameter ( Vector3 point, Vector3 linePoint, Vector3 lineDirection ) : float

Returns the parameter for the projection of the point on the given line.

PopCamera ( Camera camera ) : void

Retrieve all camera settings.

ProjectPointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3

Project point onto a line.

PushCamera ( Camera camera ) : void

Store all camera settings.

RaySnap ( Ray ray ) : object

Casts ray against the scene and report if an object lies in its path.

Repaint ( ) : void

Repaint the current view.

WorldPointToSizedRect ( Vector3 position, GUIContent content, GUIStyle style ) : Rect

Calculate a rectangle to display a 2D GUI element near a projected point in 3D space.

WorldToGUIPoint ( Vector3 world ) : Vector2

Convert world space point to a 2D GUI position.

Приватные методы

Метод Описание
ApplyDottedWireMaterial ( ) : void
ApplyWireMaterial ( ) : void
BeginHandles ( ) : void
CalcRayPlaceOffset ( Transform objects, Vector3 normal ) : float
CameraNeedsToRenderIntoRT ( Camera camera ) : bool
DistanceToDiamond ( Vector3 position, Quaternion rotation, float size ) : float
DistanceToDiamondInternal ( Vector3 position, Quaternion rotation, float size, Vector2 mousePosition ) : float
DistanceToRectangleInternal ( Vector3 position, Quaternion rotation, Vector2 size ) : float
EndHandles ( ) : void
FindNearestVertex ( Vector2 guiPoint, Transform objectsToSearch, Vector3 &vertex ) : bool
FindSelectionBase ( GameObject go ) : GameObject
GetParametrization ( Vector2 x0, Vector2 x1, Vector2 x2 ) : float
INTERNAL_CALL_CalcRayPlaceOffset ( Transform objects, Vector3 &normal ) : float
INTERNAL_CALL_DistancePointBezier ( Vector3 &point, Vector3 &startPosition, Vector3 &endPosition, Vector3 &startTangent, Vector3 &endTangent ) : float
INTERNAL_CALL_Internal_FindNearestVertex ( Camera cam, Vector2 &screenPoint, Transform objectsToSearch, Transform ignoreObjects, Vector3 &vertex ) : bool
INTERNAL_CALL_Internal_PickClosestGO ( Camera cam, int layers, Vector2 &position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
INTERNAL_CALL_Internal_PickRectObjects ( Camera cam, Rect &rect, bool selectPrefabRoots ) : UnityEngine.GameObject[]
INTERNAL_CALL_IntersectRayMesh ( Ray &ray, Mesh mesh, Matrix4x4 &matrix, RaycastHit &hit ) : bool
InitHandleMaterials ( ) : void
Internal_FindNearestVertex ( Camera cam, Vector2 screenPoint, Transform objectsToSearch, Transform ignoreObjects, Vector3 &vertex ) : bool
Internal_PickClosestGO ( Camera cam, int layers, Vector2 position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
Internal_PickRectObjects ( Camera cam, Rect rect, bool selectPrefabRoots ) : UnityEngine.GameObject[]
Internal_Repaint ( ) : void
Internal_SetHandleWireTextureIndex ( int textureIndex ) : void
IntersectRayMesh ( Ray ray, Mesh mesh, Matrix4x4 matrix, RaycastHit &hit ) : bool
PickGameObject ( Vector2 position, GameObject ignore, GameObject filter, int &materialIndex ) : GameObject
PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore, GameObject filter ) : GameObject
SetViewInfo ( Vector2 screenPosition ) : void

Описание методов

AddControl() публичный статический Метод

Record a distance measurement from a handle.

public static AddControl ( int controlId, float distance ) : void
controlId int
distance float
Результат void

AddDefaultControl() публичный статический Метод

Add the ID for a default control. This will be picked if nothing else is.

public static AddDefaultControl ( int controlId ) : void
controlId int
Результат void

CalcLineTranslation() публичный статический Метод

Map a mouse drag onto a movement along a line in 3D space.

public static CalcLineTranslation ( Vector2 src, Vector2 dest, Vector3 srcPosition, Vector3 constraintDir ) : float
src Vector2 The source point of the drag.
dest Vector2 The destination point of the drag.
srcPosition Vector3 The 3D position the dragged object had at src ray.
constraintDir Vector3 3D direction of constrained movement.
Результат float

ClosestPointToArc() публичный статический Метод

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

public static ClosestPointToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : Vector3
center Vector3
normal Vector3
from Vector3
angle float
radius float
Результат Vector3

ClosestPointToDisc() публичный статический Метод

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

public static ClosestPointToDisc ( Vector3 center, Vector3 normal, float radius ) : Vector3
center Vector3
normal Vector3
radius float
Результат Vector3

ClosestPointToPolyLine() публичный статический Метод

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

public static ClosestPointToPolyLine ( ) : Vector3
Результат Vector3

DistancePointBezier() публичный статический Метод

Calculate distance between a point and a Bezier curve.

public static DistancePointBezier ( Vector3 point, Vector3 startPosition, Vector3 endPosition, Vector3 startTangent, Vector3 endTangent ) : float
point Vector3
startPosition Vector3
endPosition Vector3
startTangent Vector3
endTangent Vector3
Результат float

DistancePointLine() публичный статический Метод

Calculate distance between a point and a line.

public static DistancePointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : float
point Vector3
lineStart Vector3
lineEnd Vector3
Результат float

DistancePointToLine() публичный статический Метод

Distance from a point p in 2d to a line defined by two points a and b.

public static DistancePointToLine ( Vector2 p, Vector2 a, Vector2 b ) : float
p Vector2
a Vector2
b Vector2
Результат float

DistancePointToLineSegment() публичный статический Метод

Distance from a point p in 2d to a line segment defined by two points a and b.

public static DistancePointToLineSegment ( Vector2 p, Vector2 a, Vector2 b ) : float
p Vector2
a Vector2
b Vector2
Результат float

DistanceToArc() публичный статический Метод

Pixel distance from mouse pointer to a 3D section of a disc.

public static DistanceToArc ( Vector3 center, Vector3 normal, Vector3 from, float angle, float radius ) : float
center Vector3
normal Vector3
from Vector3
angle float
radius float
Результат float

DistanceToCircle() публичный статический Метод

Pixel distance from mouse pointer to camera facing circle.

public static DistanceToCircle ( Vector3 position, float radius ) : float
position Vector3
radius float
Результат float

DistanceToDisc() публичный статический Метод

Pixel distance from mouse pointer to a 3D disc.

public static DistanceToDisc ( Vector3 center, Vector3 normal, float radius ) : float
center Vector3
normal Vector3
radius float
Результат float

DistanceToLine() публичный статический Метод

Pixel distance from mouse pointer to line.

public static DistanceToLine ( Vector3 p1, Vector3 p2 ) : float
p1 Vector3
p2 Vector3
Результат float

DistanceToPolyLine() публичный статический Метод

Pixel distance from mouse pointer to a polyline.

public static DistanceToPolyLine ( ) : float
Результат float

DistanceToRectangle() публичный статический Метод

Pixel distance from mouse pointer to a rectangle on screen.

public static DistanceToRectangle ( Vector3 position, Quaternion rotation, float size ) : float
position Vector3
rotation UnityEngine.Quaternion
size float
Результат float

GUIPointToWorldRay() публичный статический Метод

Convert 2D GUI position to a world space ray.

public static GUIPointToWorldRay ( Vector2 position ) : Ray
position Vector2
Результат UnityEngine.Ray

GetHandleSize() публичный статический Метод

Get world space size of a manipulator handle at given position.

public static GetHandleSize ( Vector3 position ) : float
position Vector3 The position of the handle in 3d space.
Результат float

PickGameObject() публичный статический Метод

public static PickGameObject ( Vector2 position, GameObject ignore, int &materialIndex ) : GameObject
position Vector2
ignore UnityEngine.GameObject
materialIndex int
Результат UnityEngine.GameObject

PickGameObject() публичный статический Метод

Pick game object closest to specified position.

public static PickGameObject ( Vector2 position, bool selectPrefabRoot ) : GameObject
position Vector2
selectPrefabRoot bool Select prefab.
Результат UnityEngine.GameObject

PickGameObject() публичный статический Метод

public static PickGameObject ( Vector2 position, bool selectPrefabRoot, GameObject ignore ) : GameObject
position Vector2
selectPrefabRoot bool
ignore UnityEngine.GameObject
Результат UnityEngine.GameObject

PickGameObject() публичный статический Метод

public static PickGameObject ( Vector2 position, int &materialIndex ) : GameObject
position Vector2
materialIndex int
Результат UnityEngine.GameObject

PickRectObjects() публичный статический Метод

Pick GameObjects that lie within a specified screen rectangle.

public static PickRectObjects ( Rect rect ) : UnityEngine.GameObject[]
rect UnityEngine.Rect An screen rectangle specified with pixel coordinates.
Результат UnityEngine.GameObject[]

PickRectObjects() публичный статический Метод

public static PickRectObjects ( Rect rect, bool selectPrefabRootsOnly ) : UnityEngine.GameObject[]
rect UnityEngine.Rect
selectPrefabRootsOnly bool
Результат UnityEngine.GameObject[]

PointOnLineParameter() публичный статический Метод

Returns the parameter for the projection of the point on the given line.

public static PointOnLineParameter ( Vector3 point, Vector3 linePoint, Vector3 lineDirection ) : float
point Vector3
linePoint Vector3
lineDirection Vector3
Результат float

PopCamera() публичный статический Метод

Retrieve all camera settings.

public static PopCamera ( Camera camera ) : void
camera UnityEngine.Camera
Результат void

ProjectPointLine() публичный статический Метод

Project point onto a line.

public static ProjectPointLine ( Vector3 point, Vector3 lineStart, Vector3 lineEnd ) : Vector3
point Vector3
lineStart Vector3
lineEnd Vector3
Результат Vector3

PushCamera() публичный статический Метод

Store all camera settings.

public static PushCamera ( Camera camera ) : void
camera UnityEngine.Camera
Результат void

RaySnap() публичный статический Метод

Casts ray against the scene and report if an object lies in its path.

public static RaySnap ( Ray ray ) : object
ray UnityEngine.Ray
Результат object

Repaint() публичный статический Метод

Repaint the current view.

public static Repaint ( ) : void
Результат void

WorldPointToSizedRect() публичный статический Метод

Calculate a rectangle to display a 2D GUI element near a projected point in 3D space.

public static WorldPointToSizedRect ( Vector3 position, GUIContent content, GUIStyle style ) : Rect
position Vector3 The world-space position to use.
content UnityEngine.GUIContent The content to make room for.
style UnityEngine.GUIStyle The style to use. The style's alignment.
Результат UnityEngine.Rect

WorldToGUIPoint() публичный статический Метод

Convert world space point to a 2D GUI position.

public static WorldToGUIPoint ( Vector3 world ) : Vector2
world Vector3 Point in world space.
Результат Vector2