Making the player fall if it hits the ceiling

Hi!

I am making a player controller and I am using the Character Controller and the code that can be found in the Unity Scripting API. I am still learning how to use this and I need some help. Whenever my player hits the ceiling you can kinda float around there for a little while until you fall down again. How do I make so the player will fall when they hit the ceiling and not just float for a bit before falling?

Here is my code:

moveDirection.y -= playerStats.gravity * Time.deltaTime;
		cc.Move(moveDirection * Time.deltaTime);

		if(cc.isGrounded){
			moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
			moveDirection = transform.TransformDirection(moveDirection);
			moveDirection *= playerStats.speed;

			if(Input.GetButtonDown ("Jump")){
				moveDirection.y = playerStats.jumpHeight;
			}
		}

Thanks in advance

Ok, add this to your controller script:

	void OnControllerColliderHit(ControllerColliderHit hit)
	{
		if(hit.collider.tag == "Ceiling")
		{
			moveDirection.y = -moveDirection.y;
		}
	}

And do not forget to assign tag “Ceiling” to your ceiling surfaces.