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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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 will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_
  Distance travelled across multiple splines jh092 1 7 02-23-2024, 09:44 AM
Last Post: _Aka_

Forum Jump: