Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LODs
#11
Hi

I will assess in the future if such a modification of the API is worth it. Independently, you can add this extension method to a static class in a file outside of Curvy's folder.

Code:
        public static void TeleportTo2(this CurvyController curvyController, float newPosition)         {             float distance = Mathf.Abs(curvyController.Position - newPosition);             MovementDirection direction = curvyController.Position < newPosition                 ? MovementDirection.Forward                 : MovementDirection.Backward; #if CURVY_SANITY_CHECKS             Assert.IsTrue(distance >= 0); #endif             if(curvyController.PlayState != CurvyControllerState.Playing)                 DTLog.LogError("[Curvy] Calling TeleportBy on a controller that is stopped. Please make the controller play first");             float preWrapSpeed = curvyController.Speed;             //MovementDirection preWrapDirection = curvyController.MovementDirection;             const float timeFraction = 1000;             curvyController.Speed = Mathf.Abs(distance) * timeFraction;             curvyController.MovementDirection = direction;             curvyController.ApplyDeltaTime(1 / timeFraction);             curvyController.Speed = preWrapSpeed;             //MovementDirection = preWrapDirection;         }

Putting this in a different file have the advantage of not having it modified or interfered with when updating Curvy Splines
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply
#12
Good idea, thanks!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deforming prefabs with LODs along a spine LiveWire 7 5,876 01-22-2025, 10:59 PM
Last Post: rickgplus

Forum Jump: