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
  Curvy Line Renderer for UI Spline? gekido 1 1 6 hours ago
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 2 6 hours ago
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 13 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: