StartInterpolation() public method

public StartInterpolation ( OnPathEndCallback endCallback, OnNodeArrivalCallback nodeArrival, OnNodeLeavingCallback nodeCallback, bool bRotations, eWrapMode mode ) : void
endCallback OnPathEndCallback
nodeArrival OnNodeArrivalCallback
nodeCallback OnNodeLeavingCallback
bRotations bool
mode eWrapMode
return void
Exemplo n.º 1
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 public void FollowSpline()
 {
     if (mSplineNodeInfo.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mSplineNodeInfo);
         mSplineInterp.StartInterpolation(null, null, null, true, WrapMode);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 public void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, true, WrapMode);
     }
 }
Exemplo n.º 3
0
        void OnDrawGizmos()
        {
            if (ShowHelperSpline)
            {
                Transform[] trans = GetTransforms();
                if (trans.Length < 2)
                {
                    return;
                }
                SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;
                SetupSplineInterpolator(interp, trans);
                interp.StartInterpolation(null, false, eWrapMode.ONCE);

                Vector3 prevPos = trans[0].position;

                for (int c = 0; c <= LineSoftnessFactor; c++)
                {
                    float   currTime = c * Duration / LineSoftnessFactor;
                    Vector3 currPos  = interp.GetHermiteAtTime(currTime);
                    if (c == 0)
                    {
                        currPos = trans[0].position;
                    }

                    Gizmos.color = HelperSplineColor;//new Color(mag, 0, 0, 1);
                    Gizmos.DrawLine(prevPos, currPos);
                    prevPos = currPos;
                }
            }
        }
Exemplo n.º 4
0
    // --------------------------------------------------------------------------------------------
    // UNITY CALLBACKS
    // --------------------------------------------------------------------------------------------

    void OnDrawGizmos()
    {
        //Debug.Log("drawing gizmos SplineController");
        SplineNode[] info = GetSplineNodes();
        if (info.Length < 2)
        {
            return;
        }

        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, info);
        interp.StartInterpolation(null, null, null,         /* callbacks */
                                  false /* no rotations */, WrapMode);

        Vector3 prevPos = info[0].Point;
        float   endTime = GetDuration(info);

        Gizmos.color = Color.red;
        for (int c = 0; c <= 100; c++)
        {
            Vector3 currPos = interp.GetHermiteAtTime((float)c * endTime / 100.0f);

            /* USEFUL SANITY CHECK TO DO IN THE DEBUGGER*/
            if (float.IsNaN(currPos.x))
            {
                Debug.Log("NaN while drawing gizmos!!!!");                 // should never arrive here!
            }
            //float mag = (currPos-prevPos).magnitude * 2;
            //Gizmos.color = new Color(mag, 0, 0, 1);
            Gizmos.DrawLine(prevPos, currPos);

            prevPos = currPos;
        }
    }
Exemplo n.º 5
0
    void OnDrawGizmos()
    {
        if (mSplineDrawer != null)
        {
            Transform[] trans = GetTransforms();
            if (trans.Length < 2)
            {
                return;
            }

            SetupSplineInterpolator(mSplineDrawer, trans);
            mSplineDrawer.StartInterpolation(null, false, WrapMode, true);


            Vector3 prevPos = trans [0].position;
            for (int c = 1; c <= 100; c++)
            {
                float   currTime = c * Duration / 100;
                Vector3 currPos  = mSplineDrawer.GetHermiteAtTime(currTime);
                float   mag      = (currPos - prevPos).magnitude * 2;
                Gizmos.color = new Color(mag, 0, 0, 1);
                Gizmos.DrawLine(prevPos, currPos);
                prevPos = currPos;
            }
        }
    }
Exemplo n.º 6
0
    void OnDrawGizmos()
    {
        Transform[] trans = GetTransforms();
        if (trans.Length < 2)
        {
            return;
        }

        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, trans);
        interp.StartInterpolation(null, false, WrapMode);


        Vector3 prevPos = trans[0].position;

        for (int c = 1; c <= 100; c++)
        {
            float   currTime = c * Duration / 100;
            Vector3 currPos  = interp.GetHermiteAtTime(currTime);
            float   mag      = (currPos - prevPos).magnitude * 2;
            Gizmos.color = new Color(mag, 0, 0, 1);
            Gizmos.DrawLine(prevPos, currPos);
            prevPos = currPos;
        }
    }
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, WrapMode, rotates: OrientationMode != eOrientationMode.NONE, rotationLookAhead: rotationLookAhead);
     }
 }
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, eRotationMode.PATH_ANGLE, WrapMode);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(this.CompletedInterpolation, true, WrapMode);
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(onEndCallback, true, WrapMode);
     }
 }
Exemplo n.º 11
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, LookAtDestination, WrapMode);
     }
 }
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 void FollowSpline()
 {
     //Debug.Log("FollowSpline");
     if (mTransforms.Length > 0)
     {
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, true, WrapMode);
     }
 }
Exemplo n.º 13
0
    /// <summary>
    /// Starts the interpolation
    /// </summary>
    public void FollowSpline()
    {
        if (mTransforms.Length > 0)
        {
//			gameObject.SendMessage("Init"); //.Init (); // get sibling init
            // commented Debug.Log ("followspline");
            SetupSplineInterpolator(mSplineInterp, mTransforms);
            mSplineInterp.StartInterpolation(null, true, WrapMode);
        }
    }
Exemplo n.º 14
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 public void FollowSpline()
 {
     mTransforms = GetTransforms();
     if (mTransforms.Length > 0)
     {
         Debug.Log(mTransforms.Length);
         SetupSplineInterpolator(mSplineInterp, mTransforms);
         mSplineInterp.StartInterpolation(null, true, WrapMode);
     }
 }
Exemplo n.º 15
0
 /// <summary>
 /// Starts the interpolation
 /// </summary>
 public void FollowSpline()
 {
     if (mTransforms.Length > 0)
     {
         SetupMovers(mTransforms);
         foreach (GameObject m in movers)
         {
             SplineInterpolator mSplineInterp = m.GetComponent <SplineInterpolator>();
             mSplineInterp.StartInterpolation(null, true, WrapMode);
         }
     }
 }
    void OnDrawGizmos()
    {
        Transform[] trans = GetTransforms();
        if (trans.Length < 2)
        {
            return;
        }

        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, trans);
        interp.StartInterpolation(null, eRotationMode.PATH_ANGLE, WrapMode);

        Vector3 prevPos = trans[0].position;
        //Quaternion prevRot = trans [0].rotation;
        int numberOfLines = 500;

        for (int c = 1; c <= numberOfLines; c++)
        {
            float      currTime = c * Duration / numberOfLines;
            Vector3    currPos  = interp.GetHermiteAtTime(currTime);
            Quaternion currRot  = interp.GetRotationAtTime(currTime);
            //float mag = (currPos-prevPos).magnitude * 2;
            Gizmos.color = new Color(0, 0, 1, 1);
            Gizmos.DrawLine(prevPos, currPos);

            Vector3 dP = currPos - prevPos;

            Transform _transform = new GameObject().transform;
            _transform.rotation = currRot;

            Quaternion armDir   = Quaternion.LookRotation(dP, _transform.up);
            Vector3    rightArm = armDir * Vector3.right;
            Vector3    leftArm  = armDir * Vector3.left;

            Gizmos.color = new Color(0, 1, 0, 1);

            Gizmos.DrawRay(currPos, rightArm);
            Gizmos.DrawRay(currPos, leftArm);

            prevPos = currPos;
            //prevRot = currRot;

            DestroyImmediate(_transform.gameObject);
        }
    }
    void OnDrawGizmos()
    {
        Transform[] trans = GetTransforms();

        if (trans == null)
        {
            return;
        }

        if (trans.Length < 2)
        {
            return;
        }

        // This was semi-incorrectly changed in porting this to Unity's C#:
        // SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;
        // that's not entirely correct; we need a *new* SplineInterpolator to draw the gizmos with.
        // The one that we have as a Component is the one used in game itself.
        // trying to use the same one for both means that the object just twitches in place,
        // since it then gets reset continuously by the gizmo drawing.
        // we might need to make SplineInterpolator into something other than a Monobehaviour --
        // or create an empty gameobject to AddComponent() it to (only in Editor)  --Matt M.
        GameObject         GizmoSplineInterpolator = new GameObject();
        SplineInterpolator interp = (SplineInterpolator)GizmoSplineInterpolator.AddComponent(typeof(SplineInterpolator));

        SetupSplineInterpolator(interp, trans);
        interp.StartInterpolation(null, false, WrapMode);


        Vector3 prevPos = trans[0].position;

        for (int c = 1; c <= 100; c++)
        {
            float   currTime = c * Duration / 100;
            Vector3 currPos  = interp.GetHermiteAtTime(currTime);
            //Debug.Log("currPos = " + currPos + " at " + currTime);
            float mag = (currPos - prevPos).magnitude * 2;
            Gizmos.color = new Color(mag, 0, 0, 1);
            Gizmos.DrawLine(prevPos, currPos);
            prevPos = currPos;
        }

        DestroyImmediate(GizmoSplineInterpolator);
    }
Exemplo n.º 18
0
        public void CreateRacingLine()
        {
            CheckIfMeshAlreadyCreated();

            Transform[] trans = GetTransforms();
            if (trans.Length < 2)
            {
                return;
            }

            if (MeshResolution < 16)
            {
                MeshResolution     = 16;
                LineSoftnessFactor = MeshResolution - 2;
                return;
            }
            LineSoftnessFactor = MeshResolution - 2;

            SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

            SetupSplineInterpolator(interp, trans);

            interp.StartInterpolation(null, false, eWrapMode.ONCE);

            Vector3 prevPos = trans[0].position;


            for (int c = 0; c <= LineSoftnessFactor; c++)
            {
                float   currTime = c * Duration / LineSoftnessFactor;
                Vector3 currPos  = interp.GetHermiteAtTime(currTime);

                SurfaceProperties oSurf = CastToCollider(GroundOffset, currPos, new Vector3(0f, -1f, 0f), 0, 1);

                lastindex = AddLineNode(oSurf.Position, oSurf.Normal, 1f, lastindex);
                prevPos   = currPos;
            }

            UpdateMeshFilter();
            lastindex = -1;
            numMarks  = 0;
        }
Exemplo n.º 19
0
    private SplineInterpolator SetupSpline(IEnumerable <GameObject> gos)
    {
        //converting gameobjects to a list of transforms
        List <Transform> transforms = new List <Transform>();

        foreach (GameObject go in gos)
        {
            transforms.Add(go.transform);
        }

        //setup spline
        SplineInterpolator interp = transform.GetComponent <SplineInterpolator>();

        interp.Reset();
        for (int c = 0; c < transforms.Count; c++)
        {
            interp.AddPoint(transforms[c].position, transforms[c].rotation, c, new Vector2(0, 1));
        }
        interp.StartInterpolation(null, false, eWrapMode.ONCE);
        return(interp);
    }
Exemplo n.º 20
0
    /// <summary>
    /// Returns children transforms, sorted by name.
    /// </summary>
    Transform[] GetTransforms()
    {
        if (SplineRoot == null)
        {
            return new Transform[] { }
        }
        ;

        List <Component> components = new List <Component>(SplineRoot.GetComponentsInChildren(typeof(Transform)));
        List <Transform> transforms = components.ConvertAll(c => (Transform)c);

        transforms.Remove(SplineRoot.transform);
        transforms.Sort(delegate(Transform a, Transform b) { return(a.name.CompareTo(b.name)); });

        return(transforms.ToArray());
    }

    /// <summary>
    /// Disables the spline objects, we don't need them outside design-time.
    /// </summary>
    void DisableTransforms()
    {
        if (SplineRoot != null)
        {
            SplineRoot.SetActiveRecursively(false);
        }
    }

    /// <summary>
    /// Starts the interpolation
    /// </summary>
    void FollowSpline()
    {
        if (mTransforms.Length > 0)
        {
            SetupSplineInterpolator(mSplineInterp, mTransforms);
            mSplineInterp.StartInterpolation(null, true, WrapMode);
        }
    }
}
    void Start()
    {
        mSplineInterp = GetComponent <SplineInterpolator>();

        mTransforms = GetTransforms();

        var line = GetComponent <LineRenderer>();

        if (line != null && line.enabled)
        {
            if (mTransforms.Length > 2)
            {
                line.SetVertexCount(100);

                SplineInterpolator interp = GetComponent <SplineInterpolator>();

                SetupSplineInterpolator(interp, mTransforms);
                interp.StartInterpolation(null, false, WrapMode);

                for (int c = 0; c <= 100; c++)
                {
                    float   currTime = c * Duration / 100;
                    Vector3 currPos  = interp.GetHermiteAtTime(currTime);

                    line.SetPosition(c, currPos);
                }
            }
        }

        if (HideOnExecute)
        {
            DisableTransforms();
        }

        if (AutoStart)
        {
            FollowSpline();
        }
    }
    void Start()
    {
        RootTransform = GetTransforms();
        if (CellAmount > 0)
        {
            StartCoroutine(InstantiateCells());
        }

        Transform[] trans = GetTransforms();
        if (trans.Length < 2)
        {
            return;
        }


        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, trans);
        interp.StartInterpolation(null, false, WrapMode);
        Vector3 prevPos = trans[0].position;

        lineRenderer = GetComponent <LineRenderer>();
        lineRenderer.positionCount = 100;
        for (int c = 1; c <= 100; c++)
        {
            float   currTime = c * DURATION / 100;
            Vector3 currPos  = interp.GetHermiteAtTime(currTime);
            float   mag      = (currPos - prevPos).magnitude * 2;

            prevPos = currPos;

            PositionsList[c - 1] = currPos;
        }
        lineRenderer.SetPositions(PositionsList);
        lineRenderer.SetWidth(2.5f, 2.5f);
        lineRenderer.sortingOrder       = 6000;
        lineRenderer.materials[0].color = VesselColor;
    }
Exemplo n.º 23
0
        private void CreateDistanceMeasurementTransforms()
        {
            if (Waypoints == null)
            {
                return;
            }

            DistanceTransformContainer      = new GameObject();
            DistanceTransformContainer.name = "_DistanceContainer";


            Transform[] trans = GetChildTransforms(Waypoints.transform);
            if (trans.Length < 2)
            {
                return;
            }


            if (DistancePointDensity < trans.Length)
            {
                DistancePointDensity = trans.Length;
            }

            SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

            SetupSplineInterpolator(interp, trans);
            interp.StartInterpolation(null, false, eWrapMode.ONCE);

            for (int c = 0; c <= DistancePointDensity - 1; c++)
            {
                float   currTime = c * 5 / DistancePointDensity;
                Vector3 currPos  = interp.GetHermiteAtTime(currTime);
                // float mag = (currPos - prevPos).magnitude * 2;

                GameObject _tempTrans = new GameObject();
                if (c < 10)
                {
                    _tempTrans.name = "0" + c.ToString();
                }
                else
                {
                    _tempTrans.name = c.ToString();
                }

                _tempTrans.transform.parent        = DistanceTransformContainer.transform;
                _tempTrans.transform.localPosition = currPos;
            }

            if (FinishPoint != null)
            {
                GameObject _finalPoint = new GameObject();
                _finalPoint.name                    = DistancePointDensity.ToString();
                _finalPoint.transform.parent        = DistanceTransformContainer.transform;
                _finalPoint.transform.localPosition = FinishPoint.transform.position;
                _finalPoint.transform.localRotation = FinishPoint.transform.rotation;
            }
            else
            {
                Debug.LogWarning(RGKMessages.FinishPointMissing);
                return;
            }
            //Calculate total race distance between using this created transforms.
            DistanceMeasurementObjects = GetChildTransforms(DistanceTransformContainer.transform);
            for (int i = 0; i < DistanceMeasurementObjects.GetUpperBound(0); i++)
            {
                if (i < DistanceMeasurementObjects.GetUpperBound(0))
                {
                    if (i != DistanceMeasurementObjects.GetUpperBound(0))
                    {
                        RaceLength += Vector3.Distance(DistanceMeasurementObjects[i].transform.position, DistanceMeasurementObjects[i + 1].transform.position);
                    }
                    //Debug.Log(i.ToString() + "=" + Vector3.Distance(wayPoints[i].transform.position, wayPoints[i + 1].transform.position));
                }
            }

            FixDistancePointRotations(DistanceTransformContainer);
        }
Exemplo n.º 24
0
    public void BuildTrack()
    {
        // Delete all of the children of the track holding game object
        List <Component> childComponents = new List <Component>(GetComponentsInChildren(typeof(Transform)));
        List <Transform> childTransforms = childComponents.ConvertAll(c => (Transform)c);

        childTransforms.Remove(transform);
        foreach (Transform childTransform in childTransforms)
        {
            if (childTransform.gameObject.name == "left rail" || childTransform.gameObject.name == "right rail")
            {
                DestroyImmediate(childTransform.gameObject.GetComponent <MeshFilter>().sharedMesh);
            }
            DestroyImmediate(childTransform.gameObject);
        }

        // Get all of the spline node information from the splineRoot
        Transform[] splineNodeTransforms = GetTransforms();
        if (splineNodeTransforms.Length < 2)
        {
            return;
        }

        // Build the spline interpolator object
        SplineInterpolator interp = GetComponent(typeof(SplineInterpolator)) as SplineInterpolator;

        SetupSplineInterpolator(interp, splineNodeTransforms);
        interp.StartInterpolation(null, eRotationMode.PATH_ANGLE, eWrapMode.ONCE);

        // Build a list of affine transformation matricies that represent the track sections
        List <Matrix4x4> leftTrackPolyline  = new List <Matrix4x4>();
        List <Matrix4x4> rightTrackPolyline = new List <Matrix4x4>();

        float tMax = AutoClose ? splineNodeTransforms.Length : splineNodeTransforms.Length - 1;

        tMax += 2 * resolution;

        for (float t = 0; t < tMax; t += resolution)
        {
            Transform trans = new GameObject().transform;

            trans.position = interp.GetHermiteAtTime(t);
            trans.rotation = interp.GetPathAngleAtTime(t);

            leftTrackPolyline.Add(trans.localToWorldMatrix * LeftRailPrefab.transform.localToWorldMatrix);
            rightTrackPolyline.Add(trans.localToWorldMatrix * RightRailPrefab.transform.localToWorldMatrix);

            //Debug.Log(trans.localToWorldMatrix);
            DestroyImmediate(trans.gameObject);
        }

        // Generate the rails
        GameObject leftRail = new GameObject();
        Mesh       leftMesh = new Mesh();

        leftRail.name             = "left rail";
        leftRail.transform.parent = transform;
        leftRail.AddComponent <MeshFilter>();
        leftRail.GetComponent <MeshFilter>().sharedMesh = leftMesh;
        leftRail.AddComponent <MeshRenderer>();
        leftRail.GetComponent <MeshRenderer> ().sharedMaterial = LeftRailPrefab.GetComponent <MeshRenderer>().sharedMaterial;
        MeshExtrusion.ExtrudeMesh(LeftRailPrefab.GetComponent <MeshFilter>().sharedMesh, leftRail.GetComponent <MeshFilter>().sharedMesh, leftTrackPolyline.ToArray(), false);

        GameObject rightRail = new GameObject();
        Mesh       rightMesh = new Mesh();

        rightRail.name             = "right rail";
        rightRail.transform.parent = transform;
        rightRail.AddComponent <MeshFilter>();
        rightRail.GetComponent <MeshFilter>().sharedMesh = rightMesh;
        rightRail.AddComponent <MeshRenderer>();
        rightRail.GetComponent <MeshRenderer> ().sharedMaterial = RightRailPrefab.GetComponent <MeshRenderer>().sharedMaterial;
        MeshExtrusion.ExtrudeMesh(RightRailPrefab.GetComponent <MeshFilter>().sharedMesh, rightRail.GetComponent <MeshFilter>().sharedMesh, rightTrackPolyline.ToArray(), false);

        // Generate the cross bars
        float distSinceLastCrossbar = 0;
        float cbRes = resolution / 5.0f;

        for (float t = cbRes; t < tMax; t += cbRes)
        {
            Vector3 dP = interp.GetHermiteAtTime(t) - interp.GetHermiteAtTime(t - cbRes);
            distSinceLastCrossbar += dP.magnitude;
            if (distSinceLastCrossbar >= beamDistance)
            {
                GameObject crossbar = Instantiate(crossBeamPrefab);
                crossbar.transform.parent   = transform;
                crossbar.transform.position = interp.GetHermiteAtTime(t);
                crossbar.transform.rotation = interp.GetPathAngleAtTime(t);

                crossbar.transform.position += crossbar.transform.right * crossBeamPrefab.transform.position.x;
                crossbar.transform.position += crossbar.transform.up * crossBeamPrefab.transform.position.y;
                crossbar.transform.position += crossbar.transform.forward * crossBeamPrefab.transform.position.z;

                crossbar.transform.rotation *= crossBeamPrefab.transform.rotation;

                distSinceLastCrossbar -= beamDistance;
            }
        }
    }
Exemplo n.º 25
0
    protected virtual void ConstructCurve(SplineInterpolator interp, SplineNode[] nInfo)
    {
        if (Speed <= 0 && nInfo.Length < 3) return;
        float totalLength = 0;
        float[] curveLengths = new float[nInfo.Length];
        float[] nodeArrivalTimes = new float[nInfo.Length];
        float currTime = 0;
        uint c = 1;
        bool pathEnded = false;

        //Cache the tag so we can reset it after we have calculated how fast the object should move.
        string actualTag = gameObject.tag;

        //Preserve the original position so that the object doesn't get deleted due to the simulation.
        Vector3 originalPosition = gameObject.transform.position;

        gameObject.tag = "Simulation";
        //Swap splines just in case we use mSplineInterp elsewhere.
        interp.StartInterpolation(

        //On Path End.
        () => {
            //Debug.Log("On Path Ended");
            pathEnded = true;

        },
        //On Node Arrival.
        (int idxArrival, SplineNode nodeArrival) => {
            curveLengths[c] = mTotalSegmentSpeed;
            //Debug.Log("SplineController: mTotalSegmentSpeed is " + mTotalSegmentSpeed + "from node " + nInfo[idxArrival - 1].Point + " to " + nodeArrival.Point);
            totalLength += mTotalSegmentSpeed;
            mTotalSegmentSpeed = 0;
            ++c;
        },
        //On Node Callback
        (int idxLeavingSpline, SplineNode OnNodeArrivalCallback) => {
            //Debug.Log("On Node callback: " + idxLeavingSpline);

        }, false, eWrapMode.ONCE);

        //Starts the Simulation.
        float deltaTime = 0.00005f;
        float currentTime = 0f;
        while (!pathEnded) {
            interp.Update(currentTime);
            mTotalSegmentSpeed += mSplineInterp.DistanceTraveled;
            currentTime += deltaTime;
        }
        //Debug.Log("SplineController: totalLength is " + totalLength);
        interp.Clear();

        gameObject.transform.position = originalPosition;
        //From that, evaluate how much distance between each node makes up the curve and scale that time to be the break time.
        float totalTime = GetDuration(nInfo);
        //Debug.Log("SplineController: totalTime is " + totalTime);

        float averageSpeed = totalLength / totalTime;

        float timeToEnd = 0;
        float speedMultiplier = 0;
        for (int i = 0; i < curveLengths.Length; i++)
        {
            float hermiteLengthToEvaluate = curveLengths[i];
            //Debug.Log("SplineController: hermiteLengthToEvaluate is " + hermiteLengthToEvaluate + " and the node is " + nInfo[i].Name);
            if (hermiteLengthToEvaluate > 0) {
                speedMultiplier = (hermiteLengthToEvaluate / totalLength) * (1 / Speed);
                timeToEnd = totalTime * speedMultiplier;
                //Debug.Log("SplineController: timeToEnd is " + timeToEnd);
            }

            interp.AddPoint(nInfo[i].Name, nInfo[i].Point,
                            nInfo[i].Rot,
                            timeToEnd + currTime, 0,
                            new Vector2(0, 1));
            currTime += timeToEnd;
        }
        gameObject.tag = actualTag;
    }