The events in an animation don’t seem to happen at the same exact moment every time.
For example, printing the transform.position of the fast-moving hand of a character throwing a ball when receiving an event, the values are most of the time different.
Is there a way to ensure that the values are always exactly the same?
Thanks.
No, because you’re bound to the framerate. The animation events will be checked every frame as well as the animation gets sampled every frame. The actual poses the character will have in each frame are most likely different when you replay the animation. The animation is sampled at the current animation time. Your game doesn’t run in real time, it’s always chopped into frames which have a different length. If you have a very fast animation and the framerate is quite low it’s possible that you don’t even see anything of the animation. Just think of a stroboscope.
If you need an exact throwing point that is always the same, use an empty gameobject attached to your root-bone and place it at the point where the hand would throw the ball.
If the animation is very fast you can even see where the ball is coming from. The accuracy is the more important thing in such cases.