Wrong animation when using sword

chris73it

Member
Hi,

I am using Unity 2019.20f1 and UCC 2.1.8

I am following all videos in order (as specified here https://opsive.com/videos/?pid=923)

I completed following the Melee Weapon Setup video, but I did NOT start from an empty project like the video does, instead I simply continued from the previous one (Shootable Weapon Setup.) What I now see is that the sword animation works a bit funny. It is possible it was already weird at the end of the weapon video, but sincerely I did notice the strange behavior only about halfway the Melee one.

[See #1 image] I have removed all items from the Item Set Manager except for the sword itself.

ItemSetManager.png

I see two issues:
1. [See #2 image] Nolan places his left arm in a really weird position (behind his own back) while using the sword.

NolansLeftArm.png

2. The Game view spins endlessly, even if I do not touch the mouse, or try to use the mouse to make it stop.

As an extra hint: if I wait long enough, the arm goes back into place at the end of the swinging animation, but if I click again in the middle of such animation, the game will freeze, and I will have to press ESC and then stop the game.

Any help is welcome :) Thank you, Chris
 
Hi,

I have narrowed down the issue of the funny left arm when Nolan uses a sword in his right hand I first described here https://opsive.com/forum/index.php?threads/wrong-animation-when-using-sword.1768/
( at that time I was using 2019.20f1 )

First of all, now I used Unity 2018.4.4f1 (LTS) while the UCC version is still 2.1.8

Second, this time like the video at https://opsive.com/videos/melee-weapon-setup-sword-punching-kicking/?pid=923
I started from an empty project without the AssaultRifle and/or the Bow inherited from the previous videos.
This also means that this time I did NOT try to "adjust" things as I describe in my previous post.
To be more precise I started from a brand new 2018.4.4f1 image with a freshly installed UCC 2.1.8 (even though, again, it also happened something very similar with a 2019.2.0f1 version, so I do not believe it to be relevant, other than helping ruling out pre-existing issues.)

Notice that:
- I chose to only use 3rd person (adventure) for both camera and character.
- When the video gets to 2:38, i.e. around the time when the refined coordinates for the sword mesh are used, if I press play I see the issue with the funny left arm, even though in the video it looks reasonable.

I can help with debugging.

Any help is welcome :) Thank you, Chris
 
I just repeated once more from scratch using the same 2018 unity version, same UCC 2.1.8
and was able to get some errors as soon as the sword item has been created: see attached Errors.png image for more details.

If I remember correctly, last time these errors went away around the time I did set the Animator Movement Set ID to 1: notice though, that the legs do NOT "look more like Nolan is holding a sword", i.e. Nolan's legs more or less look the same whether the Animator Movement Set ID is 1 or 0.
 

Attachments

  • Errors.png
    Errors.png
    78.9 KB · Views: 5
Yes, I can confirm that setting the Animator Movement Set ID to 1 makes the errors go away, but the left arm still looks funny. Also, reversing the value back to zero does not make any difference as far as the left arm looking funny goes. And, as already stated above, Nolan's legs do not really change position whether the Animator Movement Set ID is 1 or 0.
 
I just repeated once more from scratch using the same 2018 unity version, same UCC 2.1.8
Have you added the sword's preset to the Character IK state?

If I remember correctly, last time these errors went away around the time I did set the Animator Movement Set ID to 1: notice though, that the legs do NOT "look more like Nolan is holding a sword", i.e. Nolan's legs more or less look the same whether the Animator Movement Set ID is 1 or 0.
Arg, this exception shouldn't be occurring. See this post for the history:


Can you send a repro scene to support@opsive.com that has this error?
 
Hi Justin,

If with "sword's presets" you mean what in the video is called State Profile and currently in the latest version of UCC 2.1.8 is called Profile, then NO I did NOT and left it blank (mainly because that is what the video recommends at around 2:07.)

Said that, I restarted a new scene from scratch and I tried with the Sword option under the Profile drop down menu and the left arm now works fine.

There are still 2 exceptions that occur though:

1. The first happens immediately after pressing the play button:
ColliderOnTheMeleeHitboxIsNull.png

2. The second happens every time Nolan swings his swords (as an example, below I made Nolan swing his sword 3 times):
ObjectrReferenceNotSetToAnInstanceOfAnObject.png

I am now going to send you the scene without the presets: notice though that you could probably repro it yourself in less than 30 seconds by starting from an empty scene using UCC 2.1.8 and creating a 3rd person camera (Adventure) and a third person character (also Adventure) and then adding a sword item to it (Profile should be left empty to see the funny left arm and the exceptions, or set to Sword to still being able to see the exceptions.) As soon as you are done building the sword item, Nolan's left arm should behave funny.

As a user that bought UCC less than a week ago I would be interested in a fixed version that allows me to follow the Melee tutorial and learn from it, in particular I would appreciate if UCC could be fixed so that the Profile does not need to be set with some preset values. Thank you!

Ciao, Chris
 
Ohh.. I see where the confusion is. I thought that I responded to your original post but it never went through. When I tried to respond I pointed you towards this video that describes adding the sword preset to the character ik component:


I haven't watched the melee weapon video recently in total recently but I would have thought that I said to add that.. if not, you do need to :) I would go back through without the state configuration preset since that is setup for the Nolan character. As soon as you setup the sword and not get any errors then you can add the sword preset to the character ik component and everything should be aligned properly.
 
Hi Justin,

Unity crashes for me when I try to export the scene :(
I will try to do it again next time I install a newer version of Unity and re-install UCC from scratch: maybe I will be luckier.

Notice though that since this late morning when I did try for the first time to set the Profile of the sword item to Sword (that made the left arm stop moving funny) I have not been able to fully reproduce the issue: what I mean is that now even if I start from scratch from an empty scene and do the exact same few steps as before, and without setting the Profile to Sword, all I get is a Nolan that barely moves: just a little twitch when I click the LMB and nothing else (basically because Nolan barely moves now, I do not see the left arm misbehaving, even though it does not even try to swing the sword, something it was at least trying to do before.) I still get the exceptions. Please, let me know if there is anything else I can try to help debug this.

I am a bit confused about a detail and I need a clarification: in your previous reply, did you say that I am *supposed* to set the Profile to Sword when I create the sword item? If so, then why it works for you when you do not set it in the video? Is it because something changed in UCC since then, or I did not understand you right, and if so, what exactly am I supposed to do differently compared to what the video suggests?

Thank you, Chris
 
I am a bit confused about a detail and I need a clarification: in your previous reply, did you say that I am *supposed* to set the Profile to Sword when I create the sword item? If so, then why it works for you when you do not set it in the video? Is it because something changed in UCC since then, or I did not understand you right, and if so, what exactly am I supposed to do differently compared to what the video suggests?
No, don't use the sword profile when setting up the sword. If you get back to the same state that you were in with your original post, then only additional thing that you should need to do is add the sword preset to the Character IK component. Take a look at the state system video that I linked to, but when you are complete your character ik component should have this preset:

1568888826626.png
 
Hi Justin,
Alright, I added a new State entry named Sword with a MeleeCharacterIKPreset preset, but to me it looks like it doesn't make any difference: the only thing that made Nolan start swinging his sword is having set the Animator Movement Set ID to 1: even though that did not adjust Nolan's feet, but it did allow him to start swinging his sword nonetheless. Unfortunately, there is an issue where if I click the LMB a second time when the swinging animation is not over yet, Nolan will stop swinging from that moment on, no matter how many time I may click the LMB. And as already mentioned, the addition of the Sword state made no difference. I am not even going to ask why adding a state named Sword would make it magically start working: what I need (after a week spent trying to make the sword work..) is a set of detailed steps on how to go from an empty scene with absolutely nothing inside, starting from a pristine installation of UCC 2.1.8 to a place where the sword swings without funny arms or bugs: I believe this is something that the UCC community desperately needs since a beginner like me cannot be expected to debug the very tutorials that are supposed to teach him the basics of how to use UCC: truth is, I barely understand what you ask me to do in order to fix stuff: the community of beginners like me needs _simple_ step by step tutorials that work robustly to be able to learn the ropes of how UCC works. Notice that it does not need to be a video, even though it is likely that that would be the most clear way to go about it, but in principle a detailed list of steps would work too: the problem is that you would probably skip a miriad of steps because they would seem "obvious" to you, so the video may really be a necessity to oblige you not to miss those little details that get beginners like me in trouble. Please, let me know any way I can help you do just that.
Thank you!
Chris
 
Last edited:
I am currently traveling so can only create a quick video but here's me setting up a working sword:


- Around one minute into the video you'll notice that the sword only slashes once. This sounds similar to the problem that you currently are having. The reason for this is that the demo animator controller is setup for multiple attacks so it doesn't have a transition that keeps repeating the same attack. To fix this I added a new attack state, which is what the animator controller expects.

This is also mentioned at this time in the original melee video:

- The next problem related to the left hand positioning. This relates to the state preset and the character ik component that I was mentioning earlier. The "Sword" name comes from the Item Set Manager that I had filled in just before setting the state.
 
Top