Legacy Documentation: Version 4.6.2
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

HandleUtility.ClosestPointToArc

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function ClosestPointToArc(center: Vector3, normal: Vector3, from: Vector3, angle: float, radius: float): Vector3;
public static Vector3 ClosestPointToArc(Vector3 center, Vector3 normal, Vector3 from, float angle, float radius);
public static def ClosestPointToArc(center as Vector3, normal as Vector3, from as Vector3, angle as float, radius as float) as Vector3

Description

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

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.