Posts: 14
Threads: 6
Joined: Jun 2020
Hi, I'm using a custom controller for my game. I want to get references to new splines when I land on a new path.
Basically I have a road, and at the end of the road you get to jump on to a different road and travel along it. (see below)
So now How can I get a reference to spline B or Spline C, after jumping from spline A.
If i get the spline references I can continue along the spline path using my custom code.
I checked out the connections example scene but couldn't figure out how to code this out.
Can I use an OnTriggerEnter function to check for a spline or something when I land on a new path?
Any Help would be appreciated Thanks!
Posts: 2,110
Threads: 92
Joined: Jun 2017
Hi
Here are the available events when using a Spline Controller: https://curvyeditor.com/documentation/controllers/start#events
Notably, the OnEndReached event
Here is the API reference for the connections class: https://api.curvyeditor.com/710/class_fluffy_underware_1_1_curvy_1_1_curvy_connection.html
Notably, the ControlPointsList property
Scene 12_Train uses splines switching using connections and API. Its use case is different than (what I understand is) yours, but it might be helpful to check how it works. Its associated script is: E12_TrainCarManager. The OnCPReached method is the most interesting part.
I hope this helped
If and when you feel like it, please leave a review for the asset, that helps a lot.
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.
Posts: 14
Threads: 6
Joined: Jun 2020
Hi
Since I'm not using a spline controller from the examples, finding out list of all control points or firing an event on end reached isn't particularly going to help my use case as I can always just find out when tf = 1 to know if I'm at the end.
Can you help me to get a reference of a CurvySpline via script?
Lets say I land on a spline extrusion path at world position of CP1 of that spline. How do I get a reference of that spline?
I want to know the CurvySpline that the player is standing on, how can I do this via code?
Posts: 2,110
Threads: 92
Joined: Jun 2017
(04-13-2022, 02:00 PM)linkinballzpokemon Wrote: Since I'm not using a spline controller from the examples, finding out list of all control points or firing an event on end reached isn't particularly going to help my use case
You are right about the events, but the control points list is the list of connected control points part of a connection. Connections do exist without the need of a spline controller. So it might be helpful for your use case too.
(04-13-2022, 02:00 PM)linkinballzpokemon Wrote: Can you help me to get a reference of a CurvySpline via script?
yourControlPoint.Spline. As simple as that
https://api.curvyeditor.com/800/class_fluffy_underware_1_1_curvy_1_1_curvy_spline_segment.html#a7f76aef38bf7b32bd5fb85f9c3d0cf96
(04-13-2022, 02:00 PM)linkinballzpokemon Wrote: I want to know the CurvySpline that the player is standing on, how can I do this via code?
Use CurvySpline.GetNearestPoint on all your scene's splines, and see which one is the closest to your position
https://api.curvyeditor.com/800/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html#addc6dc085d215fdd925c4b9aafb7562c
I hope this helped
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.