I’m trying to make a character control through Character Controller. I have a script for movement and gravity
private void HandleMovement()
{
groundedPlayer = characterController.isGrounded;
playerAnimationController.UpdateLandState(groundedPlayer);
Vector2 input = inputActions.Player.Movement.ReadValue<Vector2>();
moveDirection = (transform.right * input.x + transform.forward * input.y) * player.GetWalkSpeed();
if (groundedPlayer)
{
playerVelocity.y = -2f;
}
else
{
playerVelocity.y += gravityValue * (playerVelocity.y < 0 ? 2.5f : 1f) * Time.deltaTime;
}
characterController.Move((moveDirection + playerVelocity) * Time.deltaTime);
playerAnimationController.UpdateMovement(input);
}
And I have the Character Controller set to height, radius. Center by Y is raised by 1 to make it equal to the character. But at the start of the game when the character starts to move, his Y position rises from 0 to 0.004± and hangs in this position.
Any help figuring out why would be greatly appreciated.
Thank you