Player falls quickly after moving off of an object.

In my game I have a cube that can move left and right, and jump as well. When you jump, the player arcs perfectly and falls at a very comfortable speed. But if you were to be on top of an obstacle (Example: a cube), and then moved off the edge of it without jumping, you fall straight down to the ground. You fall a lot faster then if you were to jump. Why is that? I’m using a character controller, and here is the movement code in case it is needed.

var controller : CharacterController = GetComponent(CharacterController);

moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;

if (controller.isGrounded) {
    
    if (Input.GetButton ("Jump")) {
        moveDirection.y = jumpSpeed;
        vertVel = jumpSpeed;
    }
}

// Apply gravity
vertVel -= gravity * Time.deltaTime; // apply gravity to the vertical velocity
moveDirection.y = vertVel; // combine move direction with vertical velocity

// Move the controller
controller.Move(moveDirection * Time.deltaTime);

My guess, the cube is not considered as ground and then the player is not grounded.

Add a Debug.Log(“Grounded”); in the if(grounded) and get on the cube. That would already tell you if you are or not grounded when standing on. Then we can move on with fixing the problem with maybe:

function OnCollisionStay(other:Collision){
   if(other.gameObject.tag =="Cube"){
       controller.isGrounded = true;
   }
}