Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get direction of last control point?
#5
(04-12-2023, 06:03 PM)_RicO Wrote: Hey _Aka_. Thanks so much for your quick support and reply to questions from your customers! Smile I couldn't try it right away due to the easter long weekend, but I just tried using your CurvySpline.GetTangent(1f) solution, and it seems to work (almost) perfectly. My end object is an arrow and here's what I did:

arrowDirection = LastControlPoint.GetTangent(1f);
arrow.transform.rotation = Quaternion.LookRotation(arrowDirection);

Only problem is that as soon as a point it added, it abruptly changes direction, so I had to use slerp to fix it. Although, with slerp, you can clearly see that it causes my "arrow" to flip once it rotates to a certain point. Not sure if that's the best way to smooth it out?

If simple slerping is not good enough for your usage, try using Vector3.RotateTowards: https://docs.unity3d.com/ScriptReference...wards.html
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Messages In This Thread
RE: How to get direction of last control point? - by _Aka_ - 04-13-2023, 11:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Control Point Interpolation Overrides. rickgplus 1 525 12-11-2025, 08:52 AM
Last Post: _Aka_
  12_Train junction point richardzzzarnold 5 3,408 04-16-2025, 02:19 PM
Last Post: _Aka_
  OnAfterControlPointAdded - Control Point is null jh092 5 3,178 02-04-2025, 09:31 PM
Last Post: _Aka_
  How to generate gameobject on the control point Yang Yi 1 1,609 12-10-2024, 10:14 PM
Last Post: _Aka_

Forum Jump: