// Update is called once per frame void Update() { if (!Spline) { return; } // Runtime processing if (Application.isPlaying) { // Move at a constant speed? if (MoveByWorldUnits) { // either used cached values(slightly faster) or interpolate position now (more exact) // Note that we pass mTF and mDir by reference. These values will be changed by the Move methods mTransform.position = (FastInterpolation) ? Spline.MoveByFast(ref mTF, ref mDir, Speed * Time.deltaTime, Clamping) : // linear interpolate cached values Spline.MoveBy(ref mTF, ref mDir, Speed * Time.deltaTime, Clamping); // interpolate now } else // Move at constant F // either used cached values(slightly faster) or interpolate position now (more exact) // Note that we pass mTF and mDir by reference. These values will be changed by the Move methods { mTransform.position = (FastInterpolation) ? Spline.MoveFast(ref mTF, ref mDir, Speed * Time.deltaTime, Clamping) : // linear interpolate cached values Spline.Move(ref mTF, ref mDir, Speed * Time.deltaTime, Clamping); // interpolate now } // Rotate the transform to match the spline's orientation if (SetOrientation) { transform.rotation = Spline.GetOrientationFast(mTF); } } else // Editor processing: continuously place the transform to reflect property changes in the editor { InitPosAndRot(); } }