Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending the controller, changing speed
#1
Hello,

I've been trying to extend the Spline Controller and manage all of the speed functions from there. However, when calling the Speed property in CurvyController, to set it to 0 (or anything below 1) it throwns an Index Out of Range exception. Coming from the following line in CurvySplineSegment:
Code:
            float frag = (localDistance - ApproximationDistances[lidx]) / (ApproximationDistances[lidx + 1] - ApproximationDistances[lidx]);

I'm not quite sure what the relation is to this and why the error comes up. When adjusting the speed and setting it to zero in the Refresh function in the CurvyController there aren't any problems. Needless to say that isn't a good approach if I want to give all control to a higher class.

When looking at the examplair MotorController class it also changes the Speed property directly, but without any errors.

My goal is to gradually lower the Speed to 0.
What is the reason for the error and how should I go about properly extending the CurvyController as to where I can control its speed?

Thank you.
Reply
#2
Hi,
I am right now on vacation, for two weeks. I have some guesses about the issue, but without access to a proper development environment, I can't test them. I hope the guesses will be helpful:

The issue seems to be caused by the spline's internal data not being ready, either because the code was executed at the first frame, before the spline was initialized (more about this here: https://curvyeditor.com/documentation/apigeneral#before_using_the_api), or maybe some code modifies the spline and the controller runs before the spline updates. Try calling the spline Refresh() method before the update of the controller speed.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Hi,
Did my suggestion fix your issue?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#4
Curvy 2.3.0, which should be available on the store in a couple of days, includes a rework of the controllers, which should avoid you the issue you described.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
Curvy 2.3.0, which should be available on the store in a couple of days, includes a fix to the issue you described
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Add noise to spline controller movement DekoGames 2 10 02-06-2024, 01:28 PM
Last Post: DekoGames
  Changing Lanes Antonio 1 11 09-17-2023, 08:23 PM
Last Post: _Aka_

Forum Jump: