Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting instantiated object to spline, then starting movement?
#1
Question 
Hi, I've been trying to go through your tutorials and documentation, but it's a little overwhelming for me trying to find how to do this.  Blush

I "draw" a spline at runtime, then instantiate an object (that already has an empty SplineController component attached). I need to find a way to Add the newly created CurvySpline to the Object's Spline Controller component then start the position "movement" of it along the spline.

This is what I tried to add the spline to the instatiated object's SplineController, but doesn't seem to work.
Code:
MyObject.GetComponent<SplineController>().Spline = MyNewSpline.GetComponent<CurvySpline>();

As for starting the animation of the object moving along the spline, and controlling it's speed, I'm really not sure where to even start.

As a bonus question, is there an easy way to get the First point's world position on a new spline? Similar to 
Code:
CurvySpline.GetNearestPoint()
Reply
#2
Hi
This API tutorial will be helpful
https://www.youtube.com/watch?v=CPOfoIVbeCE
This other one might be helpful too
https://www.youtube.com/watch?v=4Y_7l95Q4uQ
If you still have questions after that, please let me know.

To get a point, use CurvySpline.Interpolate. Here is its api reference
https://api.curvyeditor.com/FluffyUnderw...ine_Space_
There are other "sister" methods that might be helpful. They do have the word "Interpolate" in their name.

Did this help?
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply
#3
(06-22-2023, 09:26 AM)_Aka_ Wrote: Hi
This API tutorial will be helpful
https://www.youtube.com/watch?v=CPOfoIVbeCE
This other one might be helpful too
https://www.youtube.com/watch?v=4Y_7l95Q4uQ
If you still have questions after that, please let me know.

To get a point, use CurvySpline.Interpolate. Here is its api reference
https://api.curvyeditor.com/FluffyUnderw...ine_Space_
There are other "sister" methods that might be helpful. They do have the word "Interpolate" in their name.

Did this help?

Hey _Aka_.

Thanks so much! That did help. The first code code example that wasn't working was an embarassing error on my side  Blush haha. So let's ignore that!

I was able to find all the answers to my questions in that api document.
Reply
#4
Glad to know that everything is fine now. Feel free to ask if you encounter any issue.
Have a nice day
Please consider leaving a review for Curvy Splines, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Issue Leading to Unity Freeze Pankaj09 1 220 08-24-2026, 11:28 PM
Last Post: _Aka_
  Connecting Multiple Spline Nodes Issue Ritesh Kadam 1 171 08-22-2026, 11:24 PM
Last Post: _Aka_
  Spline Spots from 2 samples. BitBlit 8 1,107 06-30-2026, 11:49 AM
Last Post: _Aka_
  Best way to duplicate a spline with an offset Kapistijn 8 2,488 04-12-2026, 03:18 PM
Last Post: _Aka_

Forum Jump: