Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


ClosestPointToArc(Vector3, Vector3, Vector3, float, float)

Get the point on an arc (in 3D space) which is closest to the current mouse position.
Read time 1 minuteLast updated 13 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public static Vector3 ClosestPointToArc(Vector3 center, Vector3 normal, Vector3 from, float angle, float radius)

Parameters

center


normal



angle


radius

Returns

Type

Description

Vector3

Remarks

This function takes the arc defined by its parameters and "flattens" it into screen space. The closest point between the flattened arc and the current mouse position (also in screen space) is then found and converted back into a 3D point on the original 3D arc. This is useful for Handle GUIs that involve rotation of an object around the center of the arc; the 2D mouse movements are converted into 3D space in the familiar way used by Unity's built-in tools.