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, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
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, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Information Questions regarding spline colliders and collisions with rigidbodies Spyboticer 7 84 01-20-2025, 12:25 PM
Last Post: _Aka_
  Extrude mesh along spline. New and confused user GhostStalker 3 18 01-02-2025, 09:58 AM
Last Post: _Aka_
  Newly created spline is invisible quickytools 7 39 12-21-2024, 10:14 AM
Last Post: _Aka_
  Method of scattering objects along spline joebain 1 9 11-26-2024, 03:20 PM
Last Post: _Aka_

Forum Jump: