Animation synchronization issue after respawn

d.vasilev

New member
Hello. I encountered a problem. After respawning the character, its animation stops syncing over the network. In the video, I recorded how the character moves from another connected game client. After it falls into a pit, the CharacterRespawner.Respawn method is called, it gets moved to the starting platform, and the animation stops syncing. However, the animation works fine on the original game client. The problem resolves after the player jumps. The character jumps, and after landing, the animation starts syncing again. How can I fix this issue?

 
Hmm, are you able to reproduce it within the demo scene of a fresh project so I can take a look?
 
Hello! So far, I can say that the main issue is that after respawn, the LegIndex in the animator stops synchronizing. I haven't yet been able to find where this value is set and synchronized. After respawn, LegIndex is always 0 until an additional jump is made.

Could you tell me in which script the LegIndex parameter synchronization occurs?
 
Last edited:
LegIndex isn't set explicitly by the controller, it's an animation curve parameter that is set by the Animator.
 
Hello! I found the cause—it turns out that in certain situations, AbilityIndex is not applied to the animator.

Specifically, in PunCharacterAnimationController, there is such a condition during the reading of serialized network data. If this condition is removed and always applied, the issue does not occur.

if ((dirtyFlag & (short)ParameterDirtyFlags.AbilityIndex) != 0) {

var abilityIndex = (int)stream.ReceiveNext();

// When the animator is snapped the ability index will be reset. It may take some time for that value to propagate across the network.
// Wait to set the ability index until it is the correct reset value.
if (m_SnappedAbilityIndex == 0 || abilityIndex == m_SnappedAbilityIndex) {
m_AnimatorMonitor.SetAbilityIndexParameter(abilityIndex);
m_SnappedAbilityIndex = 0;
}
}

The logic is a bit unclear as to why we don’t always apply network data when sending it. If something changes or is erased in the animator, we can always resend the data with the correct values. But due to this condition, our animation breaks.
 
There were cases when the packet was delayed which caused the wrong index to be set. There may have been some other changes which prevents this from happening though so I will look at removing that line as well.
 
Back
Top