Hey,
I was working on idle animations, namely switching between multiple idles to get infinite randomized idle behaviour, but noticed that the transitions between the idles were looking pretty bad with animation “snapping” from one state to another. That is the result of Mecanim’s linear transition interpolation. So I made another test with a Direct blend tree and a script that blends the weights of the motion clips with sine interpolation.
Here’s a comparison:
Notice the linear guy on the left snapping from one pose to another while the other guy looks pretty nice and smooth. That is because nothing in the way humans move is linear, we are physical beings so acceleration is always smooth. In that video it is just noticeable, but in VR the problem is painfully immersion breaking.
So I was thinking, it would be great if Unity added a sine interpolation option to transition settings in Mecanim so everyone would be able to get smooth natural looking transitions without messy direct blend tree hacks.
Basically just pass the transition weight parameter through this function and call it a day ![]()
private static float InOutSine(float w)
{
return -0.5f * (Mathf.Cos(Mathf.PI * w) - 1f);
}
Cheers,
Pärtel
