Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nearest Point
#1
Hi guys, 

Total newbie here....

I have set up the script to move to nearest point like in the demo. But is there a way for this object to jump to the next point ahead of the player?

So instead of following it fly's ahead?

I suppose a dirty way of doing this would be to have an empty game object with a faster speed on the first spline then have the secondary follower to follow this instead.

but is there an easy way of doing this through code?
Reply
#2
so got around this with what i said above which isn't a big deal. But is there a way to following object speed up instead of snapping to the point in front?

Thanks.
Reply
#3
Hi,

First get the nearest point's TF from the player using the method GetNearestPointTF.
Then, if necessary, convert TF to distance using TFToDistance
Add the value you want to your TF or distance. This will give your the TF or distance of the point ahead of the player
Finally, use Interpolate or InterpolateByDistance to get the 3D coordinates of the new point.
All methods referenced here are documented at this link: https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#4
(04-22-2019, 12:00 PM)_Aka_ Wrote: Hi,

First get the nearest point's TF from the player using the method GetNearestPointTF.
Then, if necessary, convert TF to distance using TFToDistance
Add the value you want to your TF or distance. This will give your the TF or distance of the point ahead of the player
Finally, use Interpolate or InterpolateByDistance to get the 3D coordinates of the new point.
All methods referenced here are documented at this link: https://api.curvyeditor.com/520/class_fluffy_underware_1_1_curvy_1_1_curvy_spline.html

Thank you Smile
Reply
#5
You are welcome 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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Avoiding runtime GC allocations on control point position change Ell223 8 18 02-24-2024, 10:43 AM
Last Post: _Aka_
  Connection "next' control point jh092 3 15 11-22-2023, 11:47 AM
Last Post: _Aka_
  Spline.Length not updated unless I add a point to spline (or modify it) first. _RicO 3 6 08-26-2023, 08:41 AM
Last Post: _Aka_
  How do I get the closest Spline Control Point Lupos 2 16 05-12-2023, 01:59 AM
Last Post: Lupos

Forum Jump: