- Home /
Timing of animation events
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.
Answer by Bunny83 · Aug 29, 2011 at 09:52 PM
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.
Your answer
Follow this Question
Related Questions
In animations, is it possible to only add transform values instead of setting it? 2 Answers
2D animation (vertical movement then horizontal) 0 Answers
Animation Event don't show C# methods 1 Answer
Learning to move 1 Answer
Good design when starting animation and triggering event in animation? 2 Answers