Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how do I position a splineController on a spline in runtime to an exact position?
#7
(01-18-2018, 04:19 AM)hawken Wrote: Thanks I changed to a relative position and went from there, works nicely however in the end I had to make it a coroutine and do a while loop to make it / force it to go to the place I wanted, seems sometimes spline controllers go to 0... took about 5~10 frames before it went to the correct position.


This seems overly complicated.
Here is a simple way to do the switch:
Code:
if (splineController.Spline == Spline1)
    splineController.Spline = Spline2;
else
    splineController.Spline = Spline1;

splineController.RelativePosition = 0.5f;

//Uncomment this if your splineController has PlayAutomatically set to false
//splineController.Play();

I also attached a scene with this code in a script. You just have to click or press any button in playmode to operate the switch


Attached Files
.zip   InstantSwitcher.zip (Size: 10.18 KB / Downloads: 4)
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Messages In This Thread
RE: how do I position a splineController on a spline in runtime to an exact position? - by _Aka_ - 01-18-2018, 02:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to duplicate a spline with an offset Kapistijn 8 1,361 04-12-2026, 03:18 PM
Last Post: _Aka_
  Play() does not cause SplineController to produce expected behaviour ConCat 8 1,359 02-08-2026, 11:54 AM
Last Post: _Aka_
Smile Constant speed along a spline? tfishell 1 658 11-13-2025, 11:32 AM
Last Post: _Aka_
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 4,462 07-29-2025, 09:15 PM
Last Post: _Aka_

Forum Jump: