Hello,
After attacking, the state change back to the PlayerFreeLookState but the animation get stuck at the end of the attacking one. I can move but the animation of idle and running doesn’t work again.
My PlayerAttackingState :
public override void Tick(float deltaTime)
{
Move( deltaTime);
float normalizedTime = GetNormalizedTime();
if( normalizedTime <1f)
{
if (stateMachine.InputReader.IsAttacking)
{
TryCombatAttack(normalizedTime);
}
}
else
{
stateMachine.SwitchState(new PlayerFreeLookState(stateMachine));
}
previousFrameTime = normalizedTime;
}
My PlayerFreeLookState
public override void Tick(float deltaTime)
{
if (stateMachine.InputReader.IsAttacking)
{
stateMachine.SwitchState(new PlayerAttackingState(stateMachine, 0));
return;
}
Vector3 movement = CalculateMovement();
Move(movement * stateMachine.FreeLookMovementSpeed, deltaTime);
//stateMachine.Controller.Move(movement * stateMachine.FreeLookMovementSpeed * deltaTime);
if (stateMachine.InputReader.MovementValue == Vector2.zero)
{
stateMachine.Animator.SetFloat(FreeLookSpeedHash, 0, AnimatorDampTime, deltaTime);
return;
}
stateMachine.Animator.SetFloat(FreeLookSpeedHash, 1, AnimatorDampTime, deltaTime);
FaceMovementDirection(movement, deltaTime);
Cursor.lockState = CursorLockMode.Locked;
}
I removed the targeting script because I don’t want to use it.
Thank you