示例#1
0
        private void Update()
        {
            if (!enableMovement)
            {
                return;
            }

            distanceTravelled = WrapDistanceOverSpline(distanceTravelled + speedMeterPerSec * Time.deltaTime);

            Position = spline.GetGeodesicPositionByDistance(distanceTravelled);

            //face the direction of motion
            var forwardPos = spline.GetGeodesicPositionByDistance(WrapDistanceOverSpline(distanceTravelled + 0.01f));

            Forward = forwardPos - transform.position;
        }