Get a character to rotate instead of revolve

I am new to Unity and working on my first project. I want to make my character rotate as in spin, which it does if I take off gravity. When gravity is on and it is grounded, however, it revolves in a small circle around some invisible point. Here is my code:

var rollSpeed = 6.0;

var fastRollSpeed = 2.0;

var jumpSpeed = 8.0;

var gravity = 20.0;

var rotateSpeed = 4.0;

var duckSpeed = .5;


private var moveDirection = Vector3.zero;

private var grounded : boolean = false;

private var moveHorz = 0.0;

private var normalHeight = 2.0;

private var duckHeight = 1.0;

private var rotateDirection = Vector3.zero;

private var isDucking : boolean = false;

private var isBoosting : boolean = false;

private var isJumping : boolean = false;

var isControllable : boolean = true;

var controller : CharacterController ;

controller = GetComponent(CharacterController);

function FixedUpdate() {

	if(!isControllable)
		Input.ResetInputAxes();
	else{
		if (grounded) {
			moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
			moveDirection = transform.TransformDirection(moveDirection);
			moveDirection *= rollSpeed;
			
			
			if (Input.GetButton("Jump")) {
				moveDirection.y = jumpSpeed;
				isJumping = true;
				}
			if(Input.GetButton ("Boost")) {
				moveDirection *=fastRollSpeed;
				isBoosting = true;
			}
			if(Input.GetButton("Duck")) {
				controller.height = duckHeight;
				controller.center.y = controller.height/2 + .25;
				moveDirection *= duckSpeed;
				isDucking = true;
			}
			if(Input.GetButtonUp("Duck")){
				controller.height = normalHeight;
				controller.center.y = controller.height/2;
				isDucking = false;
			}
			if(Input.GetButtonUp("Boost")){
				isBoosting = false;
			}
		}
		else
		{if(isJumping == true) {
			if(isBoosting == true){
				if(Input.GetButton ("Jump")) {
					moveDirection.y = jumpSpeed * 2;
					isJumping = false;
					isBoosting = false;
					}
				}
			}
		}
		moveHorz = Input.GetAxis("Horizontal");
		if (moveHorz > 0)
			rotateDirection = new Vector3(0, 1, 0);
		else if (moveHorz < 0)
			rotateDirection = new Vector3(0, -1, 0);
		else
			rotateDirection = new Vector3(0, 0, 0);
		moveDirection.y -= gravity * Time.deltaTime;
		
		var flags = controller.Move(moveDirection * Time.deltaTime) ;
		controller.transform.Rotate(rotateDirection * Time.deltaTime, rotateSpeed);
		grounded = ((flags & CollisionFlags.CollidedBelow) !=0 );
		}
	}

Your issue is on line 44. You are using the ‘Horizontal’ axis for both movement and rotation when your character is grounded. My guess is that you added the rotation to a starter script that just moved the character (no rotation). The solution is to remove “Horzontal” from the calculation:

moveDirection = new Vector3(0, 0, Input.GetAxis("Vertical"));