Mecanim: Animation rotation.

Hi everyone.

I’m trying to animate a minigun in Unity which has the same animation than those in TF2. Which means that the minigun must spin up before shooting. The model has been made using Blender and the animation works fine until i change weapons.

So first when i spawn in the game the animation works (when i left click the minigun spins down and then the barrels rotate, and i when the left click is released the minigun spins up again at the starting position).

First the weapons is at this position:


Then it spins:

But there is a problem when i switch weapons. So let’s say i have the minigun and i take the shotgun and the minigun was as its starting position which means the minigun was in a vertical position like so:


and i play with the shotgun and want to take the minigun again. Well if the minigun was at its starting position before the switch and i try to fire with it, then surprise ! The minigun spins down:

and then the rotating barrel animation which should be playing at in the same position as the precedent screenshot plays in that position:

This also work the other way. If i am shooting with the minigun (the barrels are rotating horizontally) and i take the shotgun. When i’ll take the minigun again, then i’ll be able to see the rotating barrel playing horizontally.

Have you guys any idea of what is the problem ?

Can be really hard without knowing exactly what you are doing, can you share a subset of your project to expose this problem?

Here you should have only the necessary elements. If you want any informations / other elements of the project fell free to ask me.

And also thank you for the help.

1732064–109295–UnityMecanim.zip (1.01 MB)