Answered

Animation transitions causing bones to reposition incorrectly

SouthernSeth 2 years ago updated 2 years ago 4

https://media.giphy.com/media/I5CiclpNDvAEb7IlIs/giphy.gif


I've been having an issue where my animations don't transition properly. In the above GIF if you look at the Left hand on the rifle's forearm when moving between the Idle_Hip animation to the ADS animation it doesn't keep its position. For the IK_Hand_L I have disabled IK pinning to show the parent field for the transform and I have made the parent the rifle. It works as intended in just the Idle_Hip animation and the ADS animation, but when transitioning between the 2 it causes the hand to not stay on the rifle. What am I doing wrong here? 

UMotion Version:
1.29
Unity Version:
2021.3.8f1

Answer

Answer
Answered

Hi,
thank you very much for your support request.

Please note that UMotion bakes the results of the IK calculation into the final animation. That means that no IK code is executed anymore while Unity plays the animation. So when you are transitioning from one animation to another, what Unity does is it smoothly fades / interpolates all bone's FK rotation values from the current animation to the new animation. During that transition, it is not guaranteed that your hand stays exactly at the same spot relative to the firearm because the interpolation of all the left arm rotation values and those of the right arm won't mathematically generate results that keep the offset relative to each other equal. This results in your hand moving slightly relative to the firearm.


In other words, either keep the transition time really small to hide that effect or use a runtime IK algorithm that is active even while a transition is happening.


I hope I was able to explain this in a meaningful way, it's a bit complex to describe this effect. Let me know in case you have any follow-up questions.


Best regards,
Peter

Answer
Answered

Hi,
thank you very much for your support request.

Please note that UMotion bakes the results of the IK calculation into the final animation. That means that no IK code is executed anymore while Unity plays the animation. So when you are transitioning from one animation to another, what Unity does is it smoothly fades / interpolates all bone's FK rotation values from the current animation to the new animation. During that transition, it is not guaranteed that your hand stays exactly at the same spot relative to the firearm because the interpolation of all the left arm rotation values and those of the right arm won't mathematically generate results that keep the offset relative to each other equal. This results in your hand moving slightly relative to the firearm.


In other words, either keep the transition time really small to hide that effect or use a runtime IK algorithm that is active even while a transition is happening.


I hope I was able to explain this in a meaningful way, it's a bit complex to describe this effect. Let me know in case you have any follow-up questions.


Best regards,
Peter

I get what you're saying. So it seems like my only option is going to be using a runtime IK algorithm to keep that hand glued to the weapon while it transitions to the new animation. Making the transition time small is basically not going to allow me to set the speed of aiming down the weapon sight. Happen to have any good resources on runtime IK scripting?

Happen to have any good resources on runtime IK scripting?

There are several options: From Unity's Animation Rigging to free or paid third party assets on the asset store. They usually all come with their own video tutorials or documentation.

Best regards,
Peter

The Unity Animation Rigging was a super easy solution to this! Thank you!