private void DrawGizmo() { Gizmos.color = controlPointColor; for (int i = 0; i < transform.childCount; i++) { ControlPointComponent splineComponent = transform.GetChild(i).gameObject.GetComponent <ControlPointComponent>(); if (splineComponent != null) { Gizmos.DrawSphere(splineComponent.position, sphereRadius); } } // only call when updates if (!updated || spline == null) { DoUpdateSpline(); } float[] fs = spline.GetRenderPoints(); Vector3[] vs = new Vector3[fs.Length]; for (int i = 0; i < fs.Length; i++) { vs[i] = spline.GetPosition(fs[i]); } for (int i = 1; i < vs.Length; i++) { Gizmos.color = splineColor; Gizmos.DrawLine(vs[i - 1], vs[i]); } }
protected void UpdatePosition() { transform.position = spline.GetPosition(t); }