Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I merge splines only if some control points are at the sam position?
#1
Video 
I have a puzzle game where you can rotate tiles with splines, I need to connect these tiles in order to reach from start to finish, how do i merge all the splines that are together, or create connections between splines which have control points that are at the same position??

Thank you!


Attached Files Thumbnail(s)
       
Reply
#2
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
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, 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? Smile
Reply
#4
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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
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 Smile
Reply
#6
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
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
Information New free asset: Converter For Unity Splines _Aka_ 9 27 05-17-2024, 09:35 AM
Last Post: _Aka_
  Twisting Splines ZiggZagg 6 11 05-14-2024, 04:48 PM
Last Post: _Aka_
  Help with procedural roads and splines ramiroflores 1 6 05-07-2024, 08:57 AM
Last Post: _Aka_
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 3 11 04-02-2024, 02:24 PM
Last Post: _Aka_

Forum Jump: