Body item (Animator stuff)

Haytam95

Active member
Hi! (Again, don't kill me justin) ?

So, i'm diving in the items, because i don't have objects yet, i decided to start adding the Body item. So the characters can fight. As always, i'm doing a fresh start so i don't have the Demo animator. I followed this tutorial:


And i've created my custom animator trying to keep it simple as Sarah suggested and using the Demo as reference:

1572564226060.png

In this case, what i understand is:

- Slot0ItemStateIndexChange, because i want the transition to trigger when the state change (When the use ability starts)
- Slot0ItemID, this is matching the Animator Item ID, so the transition only works when i've the body equipped.
- Slot0ItemStateIndex & Slot0ItemSubstateIndex: I didn't know which one use, i understand that one of those work with the "Animator Audio States". But i don't know which.

And here we have the item in the character. No too much to say.

1572564286231.png



Also, i've created an idle state in the layer to avoid problems with the animation auto starting (Yes.. I've fought it a couple of minutes)

1572564780183.png


The problem is, that the animation stuck. It doesn't start and the arm break. Here's a gif:


I'm thinking that maybe the animation executes but only for a frame (So the arm stucks)

A little hand?


Edit: If i disable Wait for animation event


the arm break for a half of a second and then returns it's original position. So maybe the problem is that the animation isn't executing?

Thanks!
 
Last edited:
If you use the included animator controller does it work? If it does then it is something related to the animator controller, versus if it doesn't then it is likely an item or IK difference. In either case this should help narrow down where you should start looking to compare.

When you are just getting started with a new item I highly recommend getting it working on Nolan first so you can follow the video tutorial exactly. This will show you the flow so when you use your own objects you'll have an idea of what it is supposed to look like.
 
Hi @Justin , i wasn't at home so i couldn't try anything until now. So, i tried using Nolan as character (To discard IK problem) and the problem continues.


Then i tried using the Demo Animator and the problem went away:



(For some reason, the arms stay glitched a couple of miliseconds, but probable there is other little things to configure)
(The blue robot is using my animator)

Based in what you said, i'm dealing with an Animator problem. Im not able to find the bug in it, i already triple checked the parameters name, the transitions on it. Could you give me a lead where else look?


Here is my animator in the attachments. (Don't worry, i didn't include anything related to Opsive UCC)
 

Attachments

  • my_animator.unitypackage
    499.1 KB · Views: 2
Last edited:
Hi @Haytam95 - to go back to your original post Slot0ItemStateIndex relates to the Ability Index Parameter under the Item Abilities (Ultimate Character Locomotion Script). The Slot0ItemSubstateIndex is defined under the item itself so for instance [use = 2], [dry fire = 11], etc. Same for Slot1 if that is enabled.

Looking at your animator it appears the Upperbody Layer is hidden, I'm assuming you unhide that when testing this? Just want to double check :) I also noticed your Slot0ItemID is set to 1, is that correct?

It also appears the original animation events in that attack animation are missing (OnAnimatorItemUse and OnAnimatorUseComplete). The script uses these to know when use occurs and when it ends. Otherwise you need to uncheck "Wait for Animation Event" under both Use and Use Complete since you are not using events. If you do that you need to specify a duration as to when those events should happen.

Check all of that then also step through the animator after you hit play to see exactly what the animator is doing in that Upperbody Layer so you can debug it.

Hope this is helpful, sorry if some of these are obvious I am just double checking! Let me know what happens.
 
Hi Sarah!

to go back to your original post Slot0ItemStateIndex relates to the Ability Index Parameter under the Item Abilities (Ultimate Character Locomotion Script). The Slot0ItemSubstateIndex is defined under the item itself so for instance [use = 2], [dry fire = 11], etc. Same for Slot1 if that is enabled.


Slot0ItemStateIndex = Ability (I understand that 2 = Use)
Slot0ItemSubstateIndex = Item (The current combo hit)

Super clear, thanks!


Looking at your animator it appears the Upperbody Layer is hidden, I'm assuming you unhide that when testing this?

Should i be crying now? I really didn't know that you can hide layers in the Animator. I'm not home right now, but i'll check that (i don't think it is, because the idle animation in that layer executes correctly)

I also noticed your Slot0ItemID is set to 1, is that correct?

Yes, also i setted the Animator ID in the body item to use the ID 1.

1574276438176.png


1574276475899.png

I'm trying to understand how each element are connected


It also appears the original animation events in that attack animation are missing (OnAnimatorItemUse and OnAnimatorUseComplete). The script uses these to know when use occurs and when it ends. Otherwise you need to uncheck "Wait for Animation Event" under both Use and Use Complete since you are not using events. If you do that you need to specify a duration as to when those events should happen.

I'm not sure if i understand this part.

Maybe i'm wrong, i thougt that when the Use ability executes, it start the animation based on the ID and listens for changes in the animations (When it start and when it stops).

What i understand that you are saying, is that i need to especify the duration of the animation? That would totally make sense about why it isn't working.

Thanks Sarah for your insight, i will try those as soon as i arive home.
 
Last edited:
Looking at your animator it appears the Upperbody Layer is hidden, I'm assuming you unhide that when testing this? Just want to double check :)

Nailed it. The weight of every layer was at 0.

The guy is now fighting, if i left checked "Wait for animation" only once. If not, he can fight right (With some delays between actions).



It also appears the original animation events in that attack animation are missing (OnAnimatorItemUse and OnAnimatorUseComplete). The script uses these to know when use occurs and when it ends. Otherwise you need to uncheck "Wait for Animation Event" under both Use and Use Complete since you are not using events.

How can i call those events you mention to make it work like the Demo? (I see there you have checked "Wait for animation", but couldn't find where you call those) Also, where should i look to get fixed his left arm? (He point it where it's aiming, probably some IK misconfiguration of mine).

Anyway, this is great progress @Sarah thank you for pointing me out. I've been stuck for some weeks. (And i can't belive i never thought about layer weight)

Thank you.
 
How can i call those events you mention to make it work like the Demo?
These are called from animation events. Take a look at this page: https://opsive.com/support/document...controller/animation/animation-event-trigger/

Also, where should i look to get fixed his left arm? (He point it where it's aiming, probably some IK misconfiguration of mine).
This page should help:

 
Updates about this:

So, i created a new state to lower the hand weight to 0 in the Character IK component and that worked out great.

1574528078440.png

It also activate (automagically?). Not entirely sure how it's working, i'm guessing that it's because it had the same item name. (I've confirmed this)

1574528114680.png

About the animation events, i created them and those are being called correctly! I understand that UCC will execute the "Use" actions in OnAnimatorItemUse. I'm not enterily sure about OnAnimatorItemUseComplete.

1574528151211.png

I understand that probably UCC there will stop executing the code that starts at OnAnimatorItemUse, but it doesn't prevent start parallelly the UseAbility (Which causes a glitch). The only way i managed to resolve was increase "Use rate" in Melee Weapon, maybe there is another way but i couldn't find it (In the Demo scene, you were not using the Use Rate). It would be great to know, because the Use Rate isn't linked to the animation events, and with different animations length, use rate will be less precise.

Anyway, i think this is it. I think this will help a lot of future readers, Thank you @Sarah and @Justin for your explanations!
 
Top