Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching splines
#1
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!
Reply
#2
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.
Reply
#3
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?
Reply
#4
(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 Smile
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Information New free asset: Converter For Dreamteck Splines _Aka_ 0 0 07-19-2024, 08:27 PM
Last Post: _Aka_
Information New free asset: Converter For Unity Splines _Aka_ 20 61 07-19-2024, 05:15 PM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 5 06-11-2024, 07:36 AM
Last Post: _Aka_
  Twisting Splines ZiggZagg 6 14 05-14-2024, 04:48 PM
Last Post: _Aka_

Forum Jump: