Posts: 3
Threads: 1
Joined: Jan 2023
Posts: 2,161
Threads: 96
Joined: Jun 2017
Hi
Loop through all your splines, and for each one of them compare the position of its first and last CPs (Control Points) with the one of the first and last one of each spline. If close enough, create a connection and set it to synchronize its position.
Main classes to check
CurvySpline
CurvyConnection
Did this help?
Have a nice day
Posts: 3
Threads: 1
Joined: Jan 2023
Hi, so I resolved that, thanks for the idea! But I have a new query, How would I end the game if the object ping pongs before reaching a certain control point?
Posts: 2,161
Threads: 96
Joined: Jun 2017
Hi
Sorry, but answering questions about how to define your game logic is out of the scope of this forum. The CurvySpline class has various events, such as OnControlPointReached, that can be used, in combination with the rest of Curvy Splines' API, to define your game logic, including your win/loose conditions. Please take the time to explore this class's API reference to learn about the tool you are making your game with.
Thank you
Posts: 3
Threads: 1
Joined: Jan 2023
Hi, so I figured this out, but how do I detect which point the object ends on? I'm using clamp on the controller. and If it stops on the wrong puzzle piece, I want it to end the game :/ any/all help appreciated
Posts: 2,161
Threads: 96
Joined: Jun 2017
Hi
CurvySpline.ControlPoints is the list of your control points. They are gameobjects, so you can use Unity's API on them to get their data. Then just use any Unity compatible logic you would have used with any other Unity objects to detect if objects are next to another object.
CurvyController also has events, that you can use like any other Unity event to get notified if specific events happened, in this case if the controller reached a specific position.
Have a nice day