Character controller & moving while Jumping

So i’ve already modified the basic character controller package, but i’m not sure exactly how some of the functions work.

I want to be able to continue moving the character in different directions while jumping, but removing “controller.isgrounded” as a conditional seems to break the gravity completely, and no matter the strength of gravity, the character just floats down.

If i was using rigidbody physics this would be no prob, but since i “have” to use the character controller to avoid those weird collider jitters, i’m kinda stuck with it.


Here is my script as is:

public float speed = 15.0F;
	public float jumpSpeed = 30.0F;
	public static float gravity = 120.0F;
	public float turnSpeed = 0.2f;
	private Vector3 moveDirection =; //initialize movement direction
	//private Quaternion faceDirection; //Controls direction character faces.

	Animator myAnimation; // Animation controller

	CharacterController controller;

	//Rigidbody body;
	//Transform PlayerFX;

	void Awake() {

		myAnimation = GetComponentInChildren<Animator>(); //Get animation controller and assign it to this character
		controller = GetComponent<CharacterController>();

	void Update() {

		if (controller.isGrounded) {

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

			foreach (Transform child in transform)

				if (moveDirection.sqrMagnitude > 0.05f * 0.05f) { 

					myAnimation.SetBool("walking", true); //Changes avatar to walking state
					var targetRotation = Quaternion.LookRotation(moveDirection); //set target towards direction of motion
					child.rotation = child.rotation.EaseTowards(targetRotation, turnSpeed); //rotate towards the direction of motion

				}  else {

					myAnimation.SetBool ("walking", false); 


			if (Input.GetButton("Jump")) {

				moveDirection.y = jumpSpeed;

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


Btw, using this as a reference solved all my problems and then some: