Legacy Documentation: Version 2018.2 (Go to current version)
LanguageEnglish
  • C#

HandleUtility.ClosestPointToDisc

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

Submission failed

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

Close

Cancel

public static Vector3 ClosestPointToDisc(Vector3 center, Vector3 normal, float radius);

Description

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

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

Did you find this page useful? Please give it a rating: