private void UpdateState() { UpdateHorizontalSpeed(); UpdateVerticalSpeed(); Vector3 movement = _horizontalSpeed * GetMovementDirection() + _verticalSpeed * Vector3.up; //Debug.Log(movement); if (!_characterAnimator.UseRootMotion) { _characterController.Move(movement * Time.deltaTime); } if (_movementState == MovementState.Jump) { _characterController.Move(movement * Time.deltaTime); } OrientToTargetRotation(movement.SetY(0.0f)); IsGrounded = _characterController.isGrounded; UpdateGroundState(); if (_characterAnimator != null) { _characterAnimator.UpdateState(); } }
private void UpdateState() { UpdateHorizontalSpeed(); UpdateVerticalSpeed(); Vector3 movement = _horizontalSpeed * GetMovementDirection() + _verticalSpeed * Vector3.up; _characterController.Move(movement * Time.deltaTime); OrientToTargetRotation(movement.SetY(0.0f)); IsGrounded = _characterController.isGrounded; _characterAnimator.UpdateState(); }