3rd person character controller walking down hill

Ive followed a tutorial on 3dbuzz 1 on a 3rd person character system. The system uses character controller component and not rigidbody. The problem im facing is walking down hills in my terrain, when i walk down a hill the character walks out into nothing horizontally then falls back to the ground. Ive tried using a raycast to detect when im not grounded and forcing character to the ground, but it gave a lot of stutters and when i walk upwards the hill the character sometimes fell through the terrain.

RaycastHit hit;

		if (Physics.Raycast(transform.position, Vector3.down, out hit)) {
			transform.position = hit.point;
		}

The character controller needs a constant push downwards. If you’re using move to move it just increase the negative y on it while grounded. If you’re using simplemove increase the global gravity in the settings.

If both is not ok, raycast the ground where the controller would be with its next move command and recalculate the move vector so it is parallel to the ground