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
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
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
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
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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
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
  Force spline normal to be always world up GameJazz 12 21 08-08-2022, 01:20 PM
Last Post: _Aka_
  Gap between spline mesh segments Beaver_Boy 8 17 08-06-2022, 12:11 PM
Last Post: _Aka_
  How to stop spline refreshing when a control point is deleted or removed? Beaver_Boy 4 6 07-23-2022, 11:24 AM
Last Post: _Aka_
  How to get Split Length to match spline segment length? dromo 4 14 07-21-2022, 10:04 PM
Last Post: _Aka_

Forum Jump: