Adding two hands sword and animation

dereklam0528

New member
Hello,

I am trying to add a two hands sword on my third person character.

I looked up the video on adding Sword and punch weapon. I created a new weapon type and I got some animations of using the two hands sword.

on the animator, I decide to make it as item ID 26, because I am adding a new animation on top of the existing demo animator. Then copy and paste everything has got do with sword and changing the value from 22 to 26. At the same time replacing the animations I have got for 2 hands sword. However, I am not getting the result that I expected.

I just have the character hold the sword with one hand not two hands. And hitting attack button just doesn’t do anything.

What is the right way of adding new weapon? Am I doing it right?
 

dereklam0528

New member
I have done a body one, which I managed to swap some animations that I bought from asset store.

And I have just done a one hand sword. It almost works. Except when I swing the sword the second time without moving the character, the character doesn't do anything and when I start moving the character, the "use" ability become active. But no animation is played. I check both use and use complete event and have the same settings as your demo.

Screenshot 2019-10-21 at 18.22.42.pngScreenshot 2019-10-21 at 18.26.41.png
 

Justin

Administrator
Staff member
Check the Use Item State Set as well - this is what controls the parameters that are set the animator controller.
 

dereklam0528

New member
Check the Use Item State Set as well - this is what controls the parameters that are set the animator controller.
I think I have found out what really happened. I only have one attack animation, and I hit another attack before the first animation finishes. And this is what stopping another attack animation. How can I fix this?

It works fine with two attack animations. So now how can I add new two hand sword animation for my character?
 
Last edited:

Justin

Administrator
Staff member
You can ensure there is only one Use Item State added and Allow Combos is deselected.
 

Justin

Administrator
Staff member
You'll want to setup an item set that has two sword item types available:


From there it is ensuring you have the correct equip/unequip/use abilities added for each item slot. Take a look at the demo scene for an example - you'll notice that there are multiple of each ability setup. From there the animator will reflect the currently equipped item in each slot.
 

dereklam0528

New member
Hi,

I just noticed when I copy my sword animation to two hands sword, all the transitions from "Any State" disappear, this is why no animation is played. That is now fixed. However, I can't unequip the item. I have right the animation event setup - ExecuteEvent & OnAnimatorItemUnequip. But I still can't unequip the item. See attached video for your reference.

 

Justin

Administrator
Staff member
If you output the animation events on the Animator Monitor does the unequip event play? The unequip animation is likely repeating because the parameters are still the same and the animator has nowhere else to go.
 

dereklam0528

New member
Thanks, I finally had it working. Just two more small thing. After each attack, there is a small pause on the animation before exiting the attack state. I tried to change the animation event or change the exit time on the animator, but no success. Can you suggest something?

second, I unchecked the "Allow During Movement", but if I hit attack the character can still run around with attack animation. How can I make sure character stay before finishing the attack?
 

Justin

Administrator
Staff member
Can you suggest something?
A small pause generally does indicate it's something related to the animation event. You can debug the animation events sent by enabling Log Animation Events on the Animator Monitor.

second, I unchecked the "Allow During Movement", but if I hit attack the character can still run around with attack animation. How can I make sure character stay before finishing the attack?
Allow During Movement prevents that parameter index from being chosen when the character is moving, but it won't actually stop the character from moving. One way to do this would be to enable root motion so the attack controls movements.
 
Top