Saturday, May 31, 2014

Unity 4.5 Animator improvement

Have to sync your animation event accurately to physics? It just got easier with Unity 4.5. Now you have this little extra parameter at your disposal:



"Updates the animator during the physic loop in order to have the animation system synchronized with the physics engine." - http://docs.unity3d.com/ScriptReference/AnimatorUpdateMode.AnimatePhysics.html

Earlier we had a problem with syncing a climbing animation to rigidbody movement. It had to be frame accurate, but the animation would sometimes trigger one frame too early or too late. It was unpredictable.

Unity 4.5 to the rescue - the AnimatorUpdateMode worked its magic. Combining it with WaitForFixedUpdate() yields a nice solid result.

Small victories!

-Timo