Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object enter spline from collider.
#1
I was wondering if would be possible to have a ship hit a collider and then begin following a spline from it's current position. Is this something that would be possible with Curvy Splines?
Reply
#2
Hi,
Yes, through the API. Add a Spline Controller to the ship, disable the controller, and when the collider is hit, in the hit callback (on collision or on trigger) move the ship to the nearest point of the spline (if needed) and then enable the controller.
I hope this helped
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
Okay cool, I will try that. How would I find the closest point to the ship in the spline? Would I have to shoot a raycast?
Reply
#4
CurvySpline.GetNearestPointTf
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#5
Worked like a charm thank you so much! I left a 5 star review for the app on Unity Asset store! Your the best!
Reply
#6
Oh, thank you Smile
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#7
So I was able to get this to work but I found a strange glitch. When I move the parent of the segments it causes the collision object to snap to the wrong part of the curve when it collides with it. If I move the individual curve spline segments it is fine though. Do you know what maybe causing that and if there is a good solution?
Reply
#8
Make sure you are using the right Space parameter in the methods you use. Maybe you are giving some method a position in the local space while it is expecting one in the global one.
If the issue is not related to this, you can send me a reproduction case? Keep in mind that this is a public forum, so do not share Curvy Splines on a post here. Share it via email or PM.
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#9
Okay I just emailed you the scene package
Reply
#10
Hi
It ended up being an issue with using the wrong space in here
spline.GetNearestPointTF(transform.position)
You are using the override that takes a local position. Since you want to use a global position, you should replace this line with the following
spline.GetNearestPointTF(transform.position, Space.World)
Let me know if you encounter other problems.
Have a nice day
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 7 1,258 07-13-2025, 07:11 PM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 250 06-07-2025, 09:44 AM
Last Post: _Aka_
  Filling a closed spline dynamically rickgplus 1 458 04-16-2025, 08:56 AM
Last Post: _Aka_
  Morph game object along curve. mikechr2000 5 1,023 02-04-2025, 09:30 PM
Last Post: _Aka_

Forum Jump: