CharacterController.Move() moves player upward

Hey guys, just trying to get some simple movement in using the CharacterController.Move() function. It works, sort of. the player moves forward, but also moves upwards on the Y axis for some unknown reason. The movement code is:

moveDirection = transform.TransformDirection(Vector3.forward);
moveDirection *= walkspeed;
moveDirection.y -= gravity;
controller.Move( moveDirection *Time.deltaTime );

I’ve been watching the Y co-ords in the editor and it always snaps to -11.55 every time i hold the button to move, but after releasing the button the character will fall back down to the ground.

Any help figuring out why would be greatly appreciated. Thank you

have you tried freezing the position on the rigidbody?

moveDirection.y -= gravity;

Is this a serious thread?

Freezing the rigidbody stops the character from falling to the ground, so he floats all the time.

Yes.

With or without that line of code it still doesn’t work