Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching between unconnected splines
#1
I have a character which is moving on top of tree branches. I am using curvy splines and a spline controller to navigate along the branches. Upon jump what I used to was to set speed to 0, and disable it (I disable it because I couldn't find a way to make the jump happen otherwise. Character always stick to the spline.). When the character lands I get the new spline, use SwitchTo method with the value I get from GetNearestPointTf. Then I enable the controller and set the speed to what it was. After the latest update this is still working and the game goes like nothing happens however I am getting a console error with the following stack trace. 


Code:
transform.position assign attempt for 'Player' is not valid. Input position is { NaN, NaN, NaN }.
UnityEngine.Transform:set_position(Vector3)
FluffyUnderware.Curvy.Controllers.CurvyController:InitializedApplyDeltaTime(Single) (at Assets/Packages/Curvy/Controllers/CurvyController.cs:869)
FluffyUnderware.Curvy.Controllers.SplineController:InitializedApplyDeltaTime(Single) (at Assets/Packages/Curvy/Controllers/SplineController.cs:530)
FluffyUnderware.Curvy.Controllers.CurvyController:OnEnable() (at Assets/Packages/Curvy/Controllers/CurvyController.cs:705)
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)


I noticed I shouldn't be calling SwitchTo on a disabled controller. So I tried switching the order (First enable, then SwitchTo). Error disappears however this time GetNearestPointTf always returns wrong number (0 or very close to 0). So character always starts from the start.

Is there something am I missing with the latest update. Or am I doing something totaly wrong. If thats so how would you go about implementing a behavior like I described above.

Thanks
Reply
#2
Hi,
From my understanding, you use SwitchTo to instantly change the controller's spline upon landing. Based on that understanding, you don't need to call SwitchTo to do that, and should instead to just change the value of the controller's Spline property. The method SwitchTo is there so you can do a gradual transition between two splines, which is not your case.
Let me know if my answer is not helpful, and 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.
Reply
#3
(06-16-2018, 10:25 PM)_Aka_ Wrote: Hi,
From my understanding, you use SwitchTo to instantly change the controller's spline upon landing. Based on that understanding, you don't need to call SwitchTo to do that, and should instead to just change the value of the controller's Spline property. The method SwitchTo is there so you can do a gradual transition between two splines, which is not your case.
Let me know if my answer is not helpful, and have a nice day.

Thanks for the quick response. I did like you said and now the error is gone.  

Thanks  Smile
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Dreamteck Splines _Aka_ 0 0 07-19-2024, 08:27 PM
Last Post: _Aka_
Information New free asset: Converter For Unity Splines _Aka_ 20 61 07-19-2024, 05:15 PM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 5 06-11-2024, 07:36 AM
Last Post: _Aka_
  Twisting Splines ZiggZagg 6 14 05-14-2024, 04:48 PM
Last Post: _Aka_

Forum Jump: