01-16-2018, 09:07 PM (This post was last modified: 01-16-2018, 09:20 PM by _Aka_.)
My guess is that you are giving a relative distance while your controller expects an absolute one.
Position sets/gets either the absolute or relative position (TF) depending on your controller's MoveMode.
So either set that mode to Relative, or use mySplineController.RelativePosition, which always takes a relative position, regardless of the controller's MoveMode.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
(01-16-2018, 09:07 PM)_Aka_ Wrote: My guess is that you are giving a relative distance while your controller expects an absolute one.
Position sets/gets either the absolute or relative position (TF) depending on your controller's MoveMode.
So either set that mode to Relative, or use mySplineController.RelativePosition, which always takes a relative position, regardless of the controller's MoveMode.
Hello, Aka
I actually came here with the same question. I have my spline in relative mode, and I am setting Position based on that expectation (values ranging from 0.0f to 1.0f inclusive). The SplineController doesn't move for me. Is there another method I need to call? Special values needed in the other Inspector settings for this SplineController? I suspect my script-driven setting is fighting with the SplineController's own built-in calculation, although I have turned off the option to automatically play the motion.
Hi,
Did you use RelativePosition instead of Position? If yes, what was the result?
And when you say "my spline is in relative mode", do you mean Position Mode is relative, or Move Mode is relative?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
(01-17-2018, 11:06 PM)_Aka_ Wrote: Hi,
Did you use RelativePosition instead of Position? If yes, what was the result?
And when you say "my spline is in relative mode", do you mean Position Mode is relative, or Move Mode is relative?
I had move mode in absolute units when I was testing with the built-in movement, because that made the speed setting more intuitive. I discovered (as you probably were about to tell me...) that I needed this in Relative mode if I was going to set it from a script. Oops.
So the prerequisites seem to be that Position Mode and Movement Mode should be the same as what my C# script expects. I also found it needs to be in Play mode to do the updates. Again, you probably knew this already.
We can consider this solved. It's working now. Thanks!
01-18-2018, 04:19 AM (This post was last modified: 01-18-2018, 04:22 AM by hawken.)
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. heres the code:
(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:
01-19-2018, 06:26 AM (This post was last modified: 01-19-2018, 06:26 AM by hawken.)
(01-18-2018, 02:41 PM)_Aka_ Wrote:
(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:
//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
thanks for this, I'm generating "myPath" in run time from 3 other paths, I wait until it's initialised then run that script. It works fine the first time I make my SC jump to it, but for some reason if I repeat the process it always defaults to position 0 for a few frames then by brute force I keep trying to move it to the requested position. I'm guessing the new spline that is generated isn't initialised.
Hmm, initialization shouldn't take more than one frame, so maybe your issue comes from something else. If you send me the actual scene and scripts you use, I will try to find where the issue come from.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.