Puppetmaster resets Slot#ItemSubstateIndex

Klin

Member
Hi,
my use ability isn't working as it should. So the first thing was to check with the animator monitor.

Here you can see that the Slot0ItemSubstateIndex is resetting to 0 before the OnAnimatorItemUseComplete event is fired.
1631377614324.png

After a long and frustrating search I think I finally localized the originator and it seems that it is the Puppetmaster integration.

When I disable the Puppet ability, it works fine.
Also, when I comment out the following lines in Puppet.cs under OnAnimatorSnapped()
C#:
            foreach (Muscle m in puppetMaster.muscles)
            {
                m.joint.transform.position = m.target.position;
                m.joint.transform.rotation = m.target.rotation;
            }

I don't understand why the Slot0ItemSubstateIndex gets set to zero.

Maybe you have an idea what I can do to fix that?

Thanks for helping out!
 
So I tried everything I could to reproduce it in the demo scene but I couldn't.

In my scene:
- I add the default use ability.
- I have one animation with the use & use complete event (and some locomotion, checked every animation, no usecomplete inside)
- I have a mellee weapon with all default settings (using UIS also), incl. wait for animation complete event, except I added two animator audio states (same as in demo scene)

The Slot0ItemSubstateIndex gets set back to 0 right after use ability starts, as described above.
 
One of the easiest ways to debug this is to look at that log and follow the stack trace up. This will indicate what is calling that method so you can then make the change to prevent that method from being called.
 
I'm not sure how you mean following the stack trace up. Could you give me a bit of a helping hand here.

When I use the item, the Slot0ItemSubstateIndex gets set back to 0 just before OnAnimatorItemUse.

The following methods get called:

UltimateCharacterLocomotion.cs
Code:
m_AnimatorMonitor.SetItemSubstateIndexParameter(i, m_ItemSlotSubstateIndex[i]);
Code:
UpdateItemAbilityAnimatorParameters(true);
Code:
UpdateDirtyAbilityAnimatorParameters();

CharacterLocomotion.cs
Code:
UpdateAnimator();

KinematicObjectManager.cs
Code:
m_CharacterLocomotion.Move(m_HorizontalMovement, m_ForwardMovement, m_DeltaYawRotation);
Code:
for (int i = 0; i < m_CharacterCount; ++i) {
                if (m_Characters[i].CharacterLocomotion.UpdateLocation == UpdateLocation.Update) {
                    m_Characters[i].Move(false);
                    m_Characters[i].AssignFixedLocation(false);
                    m_Characters[i].AssignFixedLocation(true);
                } else {
                if (m_Characters[i].CharacterIK != null && m_Characters[i].CharacterIK.enabled) {
                    m_Characters[i].CharacterIK.Move(false);
                }
                    // Update the smoothed bone fixed location after the IK pass has executed. The animator is updated
                    // during the physics loop so the smooth bone locations only need to be assigned after the FixedUpdate
                    // loop has run.
                    if (m_FixedUpdate) {
                        m_Characters[i].AssignFixedLocation(true);
                    }
                    m_Characters[i].SmoothMove(interpAmount);
                }

I don't know who to trace it up further.
Maybe the KinematicObjectManager is a hint? The character was not moving at all while performing the use.
 
Within UpdateItemAbilityAnimatorParameters it will grab the parameters from m_ActiveItemAbilities.GetItemSubstateIndex. This is the ability that is setting the parameter. I'm guessing that it is the use ability? Within use you can set a breakpoint to determine if it is returning a non -1 value.
 
Ok I just needed several days to figure out I had recoil enabled which set the index to 0.
I guess I learned a bit in the process though.

Thanks for helping and sorry for bothering.
 
Top