Melee attack animation doesn't work when triggered, but works when aiming.

So I just added a new melee weapon (a baseball bat with his own set of arms) and it should work, but it doesn't. I made a copy of the demo FirstPersonArms and switched the animations for mine and it work for the idle and aim, but when I try attacking, it does nothing except in the animator tab (which show that everything is working just fine).

No errors pop up in the console and my attacks animations are working fine when I put them as the aiming anim, but when I put them as the attack anim, it doesn't. Try to added the animation event on them, does nothing.

So basically I can't use any other arms and animations except those of the demo and my arms have the same bone structure as the arms used in the demo.
 
It sounds like you are using a different set of arms with the FirstPersonArms animator? The FirstPersonArms is a generic animator and Unity does not support animator retargetting with generic animators. This page has some more details:


If you use FPS Mesh Tool you can use a humanoid animator which will retarget the animations.
 
Well I knew that about the FPS Mesh Tool (even had it), but the weapon came with his own set of arms and animations (also created my own set of arms and animations), plus the guns animations worked, not the melee one though. I found out what the problem was though. It was the AvatarMask of the UpperBody Layer on the animator, it used Nolan arms rig instead of mine while the basic layer used my rig. Import it in the Upperbody avatar mask and voilà. Worked with both the animations who came with the weapon as well as my own created in Blender.

I found out by recreating the katana state (and their transitions) in the basic layer (while the ones in the upperbody would also be playing at the same time), but there were something odd, those playing in the basic layer worked while those on the upperbody didn't. Yet, they both have the same animations and the animator showed that they were both playing at the same time. At that moment, I realized it had to be something related to the mask of the upperbody (since the animations worked on the base one with the arms avatar's) and for sure it was the avatar mask using Nolan FPS arms instead of mine while the humanoid one worked at the same time.

That is why everything seem to worked fine in the Animator tab, but not in-game or in-scene. For anyone who is wondering why their FPS animations for guns work, but not the melee one, there you go. If you are using the demo animators to create your own, be aware that the upperbody avatar mask uses both rig setup (Humanoid and Generic), so make sure to import your arms rig into the avatar mask if you want your custom FPS melee animations to work as intended, or like Justin said, use some humanoid animation and hide the entire body except the arms with Blender (for those who know how to use it ) or the FPS Mesh Tool (for those who doesn't know anything about 3D modeling and are ready to spend so cash).

But be aware for those using FPS Mesh Tool that you will need to get rid of the crounch/ Jumping animations for the arms or you will have a nasty surprise because you are probably using the demo animator (just like I did) as example showed in the video. Just make a copy of the FPS demo animator, swap the animations for your and it should work.

Just killed two bird with one stone. Hope it will help a poor soul like me lol.
 
Top