UnityEditor.HandleUtility.ClosestPointToArc C# (CSharp) Method

ClosestPointToArc() public static method

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
return Vector3
        public static Vector3 ClosestPointToArc(Vector3 center, Vector3 normal, Vector3 from, float angle, float radius)
        {
            Vector3[] dest = new Vector3[60];
            Handles.SetDiscSectionPoints(dest, 60, center, normal, from, angle, radius);
            return ClosestPointToPolyLine(dest);
        }

Usage Example

示例#1
0
		public static Vector3 ClosestPointToDisc(Vector3 center, Vector3 normal, float radius)
		{
			Vector3 from = Vector3.Cross(normal, Vector3.up);
			if (from.sqrMagnitude < 0.001f)
			{
				from = Vector3.Cross(normal, Vector3.right);
			}
			return HandleUtility.ClosestPointToArc(center, normal, from, 360f, radius);
		}