Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MoveByLengthFast missing on upgrade
Hi, my old code uses MoveByLengthFast. I've looked at the other solutions on here but non seem to work for me.

I have a spline like so:

  private CurvySpline ChosenPath;

then find a position on it like so:

  PathPos = ChosenPath.MoveByLengthFast(ref NearestTF, ref dir, shipdata.HalfLength, FluffyUnderware.Curvy.CurvyClamping.Loop);

I don't want to put the new spline controller on the object I'm moving so how to I get the position on the spline I need?

You can find the solution to your problem here:
Let me know if you still have an issue after that
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
This won't work for me. I think that solution needs a SplineController on a GameObject to work. I'm controlling an object on a spine from another GameObject and just want to move an object along a spline but without needing to attach a SplineController. I want the minimum possible solution which the old method gave me, I don't want all the bloat of the SplineController.

I really wish you plugin developers would not remove functionality that breaks existing games. They should always be backwardly compatible.
My bad, the solution I send you involved using a SplineController. From memory I was believing that it wasn't the case. Sorry for that.

Here is an equivalent implementation of CurvySpline.MoveByLengthFast. This implementation has the same signature, expect that it is a static method, and needs the CurvySpline instance that you want to call this on. By being static, you can have this method anywhere in your project. This way, you can avoid putting it in a Curvy Spline file, which will be overriden everytime you will import the Curvy Splines package.
        public static Vector3 MoveByLengthFast(CurvySpline spline, ref float tf, ref int direction, float distance, CurvyClamping clamping)
            float dist = spline.ClampDistance(spline.TFToDistance(tf) + distance * direction, ref direction, clamping);
            tf = spline.DistanceToTF(dist);
            return spline.InterpolateFast(tf);

About what you said concerning breaking changes:
  • Curvy Splines is backward-compatible when it comes to data and its behavior. Even when I fix a bug that corrects some faulty behavior, I give the possibility for users relying on the faulty behavior to keep that behavior. For example, the "Use Bugged RNG" parameter in the Volume Spots module.
  • When it comes to the API, Curvy Splines needs to sometimes introduce breaking changes. I will explain why this happens in the next bullet point. When introducing breaking changes, we follow the Semantic Versioning 2.0.0 standard, as stated in the Release notes page and the readme file. This means that as long as you are in the same major release (6.x.x), no breaking change is introduced. If you move to another major version (7.x.x), expect breaking changes to happen. And to make things the less painful possible, before removing any API member, I add to it an obsolete attribute explaining to the user that this method is going to be removed, and what the user should do if still relying on that code. The obsolete attribute's message shows as a compiler warning whenever that member is compiled. For example, here is the Obsolete message that was attached to the MoveByLengthFast: "This method is not used anymore, and will be deleted in a future update. Please copy its content to your project if you still need it."
    So by following the compiler warnings, and upgrading frequently to not miss any major update, a user should never have a compiler error due to a breaking change when updating Curvy Splines.
  • Curvy Splines exists since 2013. The API evolves constantly, to make it the most efficient and easily understandable possible. By keeping all the unnecessary and obsolete members in the API, we will end up with an API that has too many members, which makes it complicated to learn and in some cases confusing. So cleaning the API and enhancing it is an ongoing task that is necessary, which benefits outweigh its inconvenience, especially that there are all the measures explained earlier to make any breaking change as less impacting as possible.
Feel free to ask me if you have any question.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Thanks, I'll try the code snippet.
You are welcome. Let me know if you need something else.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.

Possibly Related Threads…
Thread Author Replies Views Last Post
  VoumeController Implementation Missing Methods in API pako88 3 6 04-24-2024, 11:16 PM
Last Post: _Aka_
  Upgrade from 7.1.8 to 8.x? PaulM 3 8 02-01-2024, 09:31 AM
Last Post: _Aka_
Information Curvy Splines 8.0.0 is available, and it is a big upgrade _Aka_ 3 96 06-29-2023, 08:23 AM
Last Post: Marki
  Missing Loader errors after build FanManPro 8 9 01-20-2023, 11:45 AM
Last Post: _Aka_

Forum Jump: