unity-game-enginespline

How to know the exact Knot on spline the game object is on in Unity?


I have used Spline to animate a GameObject I want to disappear my GameObject when it is on Knot[4] and re-visible it on Knot[6]. But I don't know exactly how to do this. Is there any way to achieve this? Thanks in advance.


Solution

  • You're probably looking for SplineUtility.ConvertIndexUnit() . SplineUtility.Evaluate() might also help, depending on what you need. For real-time tracking, I don't think you can avoid the dreaded Update() way of putting if-checks there. I haven't found any runtime events, unfortunately.