04-13-2023, 11:27 AM
(04-12-2023, 06:03 PM)_RicO Wrote: Hey _Aka_. Thanks so much for your quick support and reply to questions from your customers! 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/Vector3.RotateTowards.html
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.