/// <summary> /// This is a built in UNITY class that handles on scene GUI visuals /// </summary> private void OnSceneGUI() { path = target as pathSystem; for (int x = 0; x < path.bezierSplines.Length; x++) { handleTransform = path.bezierSplines[x].transform; handleRotation = Tools.pivotRotation == PivotRotation.Local ? handleTransform.rotation : Quaternion.identity; Vector3 p0 = ShowPoint(0, x); for (int i = 1; i < path.bezierSplines[x].ControlPointCount; i += 3) { Vector3 p1 = ShowPoint(i, x); Vector3 p2 = ShowPoint(i + 1, x); Vector3 p3 = ShowPoint(i + 2, x); Handles.color = Color.gray; Handles.DrawLine(p0, p1); Handles.DrawLine(p2, p3); Handles.DrawBezier(p0, p3, p1, p2, Color.green, null, 2f); p0 = p3; } } if (toggleDirShow) { ShowDirections(); } }
/// <summary> /// This overrides the onInspectorGUI which modifies the inspector of the class bezierSpline /// </summary> public override void OnInspectorGUI() { //DrawDefaultInspector(); path = target as pathSystem; /* * if (selectedIndex >= 0 && selectedIndex < spline.ControlPointCount) * { * DrawSelectedPointInspector(); * } * /* * if (GUILayout.Button("Add Curve")) * { * Undo.RecordObject(path, "Add Curve"); * path.AddBezierSpline(); * EditorUtility.SetDirty(path); * }*/ toggleDirShow = GUILayout.Toggle(toggleDirShow, "Toggle Directions"); if (GUILayout.Button("Reset Curve")) { path.Reset(); EditorUtility.SetDirty(path); } }
public void SplitCurve() { Vector3 point = Points[Points.Length - 1]; pathSystem path = transform.parent.GetComponent <pathSystem>(); path.SplitPath(this); //EnforceMode(Points.Length - 4); }
public void joinSpline() { pathSystem path = transform.parent.GetComponent <pathSystem>(); path.JoinSpline(this); }