My pickup melee weapon doesn't attack (video attached)

konig6

New member
I've setup a simple scene, where the player starts with a melee weapon in his right hand (a FireAxe). The FireAxe attacks as expected.

The player can pick up a CrowBar, which equips in his left hand. The CrowBar appears correctly, however when I click the weapon doesn't animate. I made a video showing all relevant values for the First person player and the Crowbar pickup:



Why might this be? I've included a video showing the issue and the settings. Thank you.
 
I'm not sure if this is the cause but one thing that I see wrong is that the Movement Set ID is 0 when for melee weapons it should be 1. One of the use conditions within the animator could be that the Movement Set ID is 1.

If that doesn't work, if you use the same Animator ID as the axe does it work?
 
If that doesn't work, if you use the same Animator ID as the axe does it work?
The "Animator ID" for both the Pickaxe (default loadout) and the Crowbar (pickup item) are set to 22. No luck.

I'm not sure if this is the cause but one thing that I see wrong is that the Movement Set ID is 0 when for melee weapons it should be 1. One of the use conditions within the animator could be that the Movement Set ID is 1.

The "Animation Movement Set ID" for the Pickaxe (default loadout) is 0 and it attacks correctly. In your Melee Weapon Setup (Sword, Punching & Kicking) video you don't mention that this value should be 1, or if so I missed it.

Anyway I've tried setting it to 1 for both the Pickaxe and the Crowbar, and the same issue persists: the Pickaxe (default loadout) attacks, the Crowbar (pickup item) doesn't.

I've tried creating another Pickup item (a Bat this time), carefully setting all of the corresponding values. Same problem.

It seems like picked-up melee weapons won't attack for some reason. Can you can make a quick check on your own from an empty scene?

Worth noting that my First person player does not have a Character applied (left it empty in the character creation wizard). Also, I've disabled the following GameObjects to hide the arms:
  • LeftArm ==> Disabled
  • LeftArmor ==> Disabled
  • RightArm ==> Disabled
  • RightArmor ==> Disabled
I've tried enabling them back again. Still the same problem.

I'm stuck at this point.
 
The "Animator ID" for both the Pickaxe (default loadout) and the Crowbar (pickup item) are set to 22. No luck.

If the character still doesn't attack using the crowbar with a value of 22 then something is likely wrong with the melee weapon settings. Have you tried comparing the MeleeWeapon component between your axe and crowbar?

When the character is attacking does the Slot0/1StateIndex change to a value of 2? This is the value that is used to indicate an attack.

In your Melee Weapon Setup (Sword, Punching & Kicking) video you don't mention that this value should be 1, or if so I missed it.
I talk about the Movement Set ID at this time in the video:

 
I talk about the Movement Set ID at this time in the video:
My bad, I missed it. I've set it to 1 for both the Pickaxe and the Crowbar (which is now a Bat, as I created another pickup weapon to make sure the error persists).

The "Melee Weapon" scripts are completely identical (with the exception of using a Trail in the Pickaxe and not in the Bat). I've taken screenshots for visual proof:

1 of 3:

errorattackingmelee_1_.jpg

2 of 3:
errorattackingmelee_2.JPG

3 of 3:
errorattackingmelee_3.JPG
 
I'm trying to get on well with UCC but it hates me! I know it's a well-tested and debugged product.

Hopefully you will be able to give me some guidance to get me out of this seemingly-simple problem.
 
I know that I could get my own scene working so it's better to explain how to debug this so you have a better understanding of how the asset works.

When debugging animation problems the first step is to look at the animator to determine if the correct parameter values are set. If the values are what you'd expect then the next step is to make sure there is a transition for those values. In this case the correct parameter values likely are not set.

Let's look at the Upper Body -> Sword animator. The transition to Attack 1 From Idle has the following conditions:

1585223728214.png

You placed your axe in slot 1, correct? That means that Slot0ItemID will not be 22. Slot1ItemID will be 22. In order to fix this you'll either need to adjust the animator (and animations) so it works with a left handed melee weapon, or change your axe so it is in the right hand with a SlotID of 0. We don't have any melee weapons included which use Slot0 (the left hand).
 
That was the issue indeed. Right out of the box, UCC doesn't know how to attack a Melee weapon in case the player is a lefty.

In order to fix this you'll either need to adjust the animator (and animations) so it works with a left handed melee weapon
I don't think I know how exactly should I do this. Adjust the animations?

I hope I can make a suggestion for UCC 2.2, and a constructive side note:

A tool should not only be powerful and customizable. It should also be artist-friendly / novice-friendly. During my Item creation process, I missed a "Left-handed" checkbox which, if checked, will automatically wire up everything behind-scenes to make the item work with the left hand (a weapon, in this case). The user should not have to change animations/animators to make a weapon work with the left hand. Why didn't you decide to make it work left-handed by default, for example? I hope you could integrate this option in a future release of UCC, which I think is fundamental:
LefthandedOption.png

By the way, I have some chances of survival now ;)
 
Glad you got it working!

The user should not have to change animations/animators to make a weapon work with the left hand. Why didn't you decide to make it work left-handed by default, for example?

We don't have any left hand melee animations. The focus of the character controller is to be extensible and to allow the user to add in their own art content. When you release your game you should be able to completely remove the Demo folder, which includes the animator controller and all animations. You'll instead want to use your own content.

If you specify a visible item for the third person object it will show a dropdown for where you want to place the item on humanoid models. It doesn't necessarily mean that those animations are included in the demo folder.

ItemBuilderMyAssaultRifle.png
 
Thank you Justin. I haven't checked if you already have one, but maybe you could make a video on how to make a custom animation. This would be the perfect starting point: picking up a melee weapon that's intended to be used with the left hand, and it doesn't work right out of the box ==> you show us an example of how to create the animation and wire it up with UCC ==> we would then be able to create other more sophisticated animations.
 
Agreed. I spent hours to figure out that 1 should be 0 ... it’s unforgiving for such things. As discussed times over discord it would be great to have a « from scratch » video.
 
Justin's videos are great. The problem is that he doesn't get into detail on certain "so-much-needed" things, like creating a custom animation for a left-handed weapon.

I know the real power of UCC lies in its high level of customisation. This is actually the reason why certain things need to be explained a little more in-depth.

I'm not trying to achieve this (not because UCC can't, but because of my limited knowledge):

But maybe a tutorial on how to set up a simple left-hand melee weapon animation would be awesome.
Hopefully Justin will hear us and keep adding useful videos to his already-useful docs page. ??
 
Top