void FixedUpdate() { if (playerCanMove_) { newMovementInput = playerInput.movementInput; if (playerInput.movementInput == Vector2.zero) { SetIdlePlayer(); } else { float realBuildUpSpeed = 1f - Mathf.Pow(1f - buildUpSpeed, Time.deltaTime * 60); movementInput = Vector2.Lerp(movementInput, newMovementInput, realBuildUpSpeed); animationController.EnableWalk(); if (playerInput.run) { currentSpeed = startSpeed * speedMultiplier; animationController.EnableRun(); } heading = (Vector3.Normalize(Camera.main.transform.forward) * newMovementInput.y + Vector3.Normalize(Camera.main.transform.right) * newMovementInput.x); heading.y = 0.0f; transform.forward = transform.forward;//Vector3.Slerp(transform.forward, heading, rotationSpeed * Time.deltaTime); rb.velocity = heading * currentSpeed; playerRepresentation.transform.rotation = Quaternion.Lerp(playerRepresentation.transform.rotation, Quaternion.LookRotation(heading, Vector3.up), playerRotationSpeed); currentSpeed = startSpeed; } } else { SetIdlePlayer(); } }