I tried this using some different animations, and each animation has a slightly different playback speed. When I go to dodge, The dodge seems to be slightly too long for the left and right dodges, and lasts an additional few seconds on the backstep dodge. I tried to set the dodge duration equal to the animator’s current animation’s clip length divided by that clip’s playback speed, but that doesn’t seem to fix the issue.
stateMachine.animator.GetCurrentAnimatorStateInfo(0).normalizedTime / stateMachine.animator.GetCurrentAnimatorStateInfo(0).speed
I also tried using that same value instead of using remainingDodgeTime -= deltaTime to check if we should be finished dodging.
if ((stateMachine.animator.GetCurrentAnimatorStateInfo(0).normalizedTime / stateMachine.animator.GetCurrentAnimatorStateInfo(0).speed) >= 1)
{
stateMachine.SwitchState(new PlayerTargetingState(stateMachine));
}
Does anyone have any recommendations?