- Home /
HOW i SOLVE ROOT MOTION PROBLEM WITH ANIMATIONS MADE IN UNITY
I have come across a frustrating problem with the animations I make in the Unity animation editor. I have made an idle animation for my gun that makes it bob and am using an animation that came with the package for recoil when shooting. The animations run fine until I added a script that slerps the gun into place to aim down the sight, the animation would play like normal but the slerp would not do anything. I solved this by enableing root motion in the script when slerping the gun. It caused the Idle animation to stop while holding the aim button but that is fine. Now I have made my own recoil animation in the Unity editor to replace the imported one but because I have to enable root motion while aiming the gun the recoil animation will only work with hip fire. I selected my animation in the project files and clicked "Generate Root Motion Curves" and that made the recoil animation work while aiming but my gun rotates to the left on its y axis while I shoot even though there is no rotation on the y axis in my animation. There is a rotation on the x axis though.
Some other information that may be useful - The gun model I am using animation type is set as Legacy, Generation is set to store in root (new). I tried changing the gun to Generic but that just made the gun movement really weird and it still rotates when shooting.
Can anyone help me with this?
thanks