Character is running above the ground

I have one animated character,my requirement is it should run on the top of the buildings and jump form the one building to an other building.Initially I am setting its position on the building, but when I play the game it is running in the air (some gap between the building and the character). Any one help me to fix this.

private var walkSpeed : float = 1.0;
private var gravity = 5;
private var moveDirection : Vector3 = Vector3.zero;
private var charController : CharacterController;
private var jump =0.0;
private var gameOver: boolean =false;

function Start()
{
    charController = GetComponent(CharacterController);
    animation.wrapMode = WrapMode.Loop;
}

function Update () {

	if(charController.isGrounded)
	{
		Debug.Log("Entered into if");
		jump=0.0;
		animation.CrossFade("run");
		walkSpeed = 1;
		
		if(Input.GetButtonDown("Jump"))
		{
		       jump=2.0;
		       walkSpeed=2.0;
		       animation.CrossFade("jump");
		}

		moveDirection = Vector3(0,jump,walkSpeed);
		moveDirection = transform.TransformDirection(moveDirection);	
	}
	moveDirection.y -= gravity * Time.deltaTime;
	charController.Move(moveDirection * (Time.deltaTime* walkSpeed) );
	//walkSpeed=0;
	}

i think it is becaus the CharacterController collider is to big try tunning it a bit

demonicmetal cs

You mean Capsule collider , but it is not big it is having same the height as character.

Something to check… has the gravity value been changed in the inspector? The value entered there overrides what is set in the script, so make sure it is set to the right value.

If the capsule collider is the exact same height as the character, check the Character Controller’s skin width. The actual place where the collision happens is based on the Character Controller’s shape plus the skin width. Reducing the skin width (or, better, reducing the size of the capsule so that the collisions happen at the correct place when the skin width is added) may fix your issue.