public override void OnInspectorGUI() { DrawDefaultInspector(); dnp = target as DebugNearestPoint; SplineLine spline = dnp.spline; Vector3 position = dnp.transform.position; DrawDebug("Nearest Progress :", spline.GetNearestProgressOnSpline(position).ToString()); }
private void OnSceneGUI() { dnp = target as DebugNearestPoint; handleTransform = dnp.transform; handleRotation = Tools.pivotRotation == PivotRotation.Local ? handleTransform.rotation : Quaternion.identity; SplineLine spline = dnp.spline; Vector3 position = dnp.transform.position; Vector3 nearestPoint = spline.GetNearestPointOnSpline(position); //Vector3 nearestPoint = spline.GetNextControlPoint(0); Debug.Log(nearestPoint.ToString()); float size = HandleUtility.GetHandleSize(position); //spline.transform.TransformPoint(nearestPoint) Handles.DrawLine(nearestPoint, position); Handles.Button(nearestPoint, Quaternion.identity, size * handleSize, size * pickSize, Handles.DotHandleCap); }