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?

[font=Menlo, Monaco, "Courier New", monospace]  [/font]
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
  Asteroid scene missing from 7.1.4 puzzlekings 3 406 03-11-2021, 08:37 AM
Last Post: _Aka_
  Curvy - Missing Playmaker Actions! HELP! toxicfrog 3 5,520 04-19-2017, 06:44 PM
Last Post: Jake
  Unity 5.1.1 upgrade issue puzzlekings 3 5,825 06-20-2015, 07:25 PM
Last Post: puzzlekings
  Unity 5.1.1 upgrade issue puzzlekings 0 2,807 06-19-2015, 10:01 AM
Last Post: puzzlekings

Forum Jump: