HandleUtility Manual     Reference     Scripting  
Scripting > Editor Classes > HandleUtility
HandleUtility

Helper functions for Scene View style 3D GUI

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

Class Variables
acceleration

Get standard acceleration for dragging values (Read Only).

niceMouseDelta

Get nice mouse delta to use for dragging a float value (Read Only).

niceMouseDeltaZoom

Get nice mouse delta to use for zooming (Read Only).

Class Functions
CalcLineTranslation

Helper function for doing arrows.

PointOnLineParameter

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

ProjectPointLine

Project point onto a line.

DistancePointLine

Calculate distance between a point and a line.

DistancePointBezier

Calculate distance between a point and a bezier

DistanceToLine

Pixel distance from mouse pointer to line.

DistanceToCircle

Pixel distance from mouse pointer to camera facing circle.

DistanceToRectangle

Pixel distance from mouse pointer to a rectangle on screen

DistancePointToLine

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

DistancePointToLineSegment

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

DistanceToDisc

Pixel distance from mouse pointer to a 3D disc.

ClosestPointToDisc

Get the nearest 3D point.

DistanceToArc

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

ClosestPointToArc

Get the nearest 3D point.

DistanceToPolyLine

Pixel distance from mouse pointer to a polyline.

ClosestPointToPolyLine

Get the nearest 3D point.

AddControl

Record a distance measurement from a handle.

AddDefaultControl

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

GetHandleSize

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

WorldToGUIPoint

Convert world space point to a 2D GUI position.

GUIPointToWorldRay

Convert 2D GUI position to a world space ray.

WorldPointToSizedRect

Figure out a rectangle to display a 2D GUI element in 3D space.

PickRectObjects

Pick game object in specified rectangle

PickGameObject

Pick game object closest to specified position.

PushCamera

Store all camera settings

PopCamera

Retrieve all camera settings

RaySnap

Casts ray against the scene.

Repaint

Repaint the current view