Example #1
0
        public void CanEvaluateSpline()
        {
            Spline spline = Spline.Create();

            spline.transform.position = Vector3.zero;
            SplineValue value = spline.Evaluate(0.5f);

            Assert.IsNotNull(spline, "Spline was null.");
            Assert.AreEqual(new Vector3(0.0f, 0.0f, 0.5f), value.position, "Spline evaluation failed.");
        }
        void OnSceneGUI(SceneView sceneView)
        {
            // If target is invalid exit
            if (m_Target == null)
            {
                return;
            }

            // Evaluate Spline at t position
            SplineValue splineValue = m_Target.Evaluate(t);

            // Draw sphere gizmo at Point position
            Handles.color = DebugColors.white.wire;
            Handles.SphereHandleCap(0, splineValue.position, Quaternion.identity, 0.1f, EventType.Repaint);

            // Update SceneView
            sceneView.Repaint();
        }