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
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 14 02-26-2024, 09:49 AM
Last Post: _Aka_
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Distance travelled across multiple splines jh092 1 7 02-23-2024, 09:44 AM
Last Post: _Aka_

Forum Jump: