public static void DrawPathGizmo(SplineBase path, Color pathColor) { // Draw the path Color colorOld = Gizmos.color; Gizmos.color = pathColor; float step = 1f / path.Resolution; Vector3 lastPos = path.EvaluatePosition(path.MinPos); Vector3 lastW = (path.EvaluateOrientation(path.MinPos) * Vector3.right) * path.Appearances.Width / 2; for (float t = path.MinPos + step; t <= path.MaxPos + step / 2; t += step) { Vector3 p = path.EvaluatePosition(t); Quaternion q = path.EvaluateOrientation(t); Vector3 w = (q * Vector3.right) * path.Appearances.Width / 2; Vector3 w2 = w * 1.2f; Vector3 p0 = p - w2; Vector3 p1 = p + w2; Gizmos.DrawLine(p0, p1); Gizmos.DrawLine(lastPos - lastW, p - w); Gizmos.DrawLine(lastPos + lastW, p + w); #if false // Show the normals, for debugging Gizmos.color = Color.red; Vector3 y = (q * Vector3.up) * path.m_Appearance.width / 2; Gizmos.DrawLine(p, p + y); Gizmos.color = pathColor; #endif lastPos = p; lastW = w; } Gizmos.color = colorOld; }