Making a rolling ball jump, but only when it is touching the ground

I know that a lot of these questions have already been asked, but I have looked through many, and none of them seem to work for me. I have a ball that is rolling, so it’s y axis is not always straight up. I need it to increase it’s y axis (global). I have gotten this to work, but as soon as I add in the character controller, it stops jumping. Here is my code, any help is appreciated.

This section is under Update, and the groundContact variable is set.

Code is in C#

		{
			CharacterController controller = GetComponent<CharacterController>();
			if (controller.isGrounded)
				groundContact = true;
		}

		if (Input.GetKeyDown(KeyCode.Space) && groundContact)
			rb.AddForce(new Vector3(0, 10, 0), ForceMode.Impulse);

Simply use these

groundContact = controller.isGrounded;

instead of these

   if (controller.isGrounded)
             groundContact = true;

I think you should set groundContact to false at the end of your Update, or it will continouosly be true after jumping once. If controller.isGrounded doesn’t work (Test with Debug?), try to shoot a raycast down.

public Transform GroundCheck;
public LayerMask WhatIsGround;
float GroundRadius = 0.2f;
bool Grounded = false;

    void FixedUpdate ()
        {
            Grounded = Physics2D.OverlapCircle(GroundCheck.position, GroundRadius, WhatIsGround);
    }

I used this code for make my 2D game, when the sprite touch the floor set the bool true.
You have to create an empty child game object.

Thank you everyone for helping me, I have figured it all out, it works great now. I have ended up using a rigidbody collider and trigger to get it to jump only when touching the ground. All of the replies so far has given me a little advice that has helped me figure it out. I will post my code below just in case someone else needs it.

Code is in C#

	void Update()
	{
		if (Input.GetKey (KeyCode.Space) && groundContact) 
		{
			rb.AddForce (new Vector3 (0, 10, 0), ForceMode.Impulse);
			groundContact = false;
		}
	}
void OnTriggerEnter(Collider other)
	{
		if (other.gameObject.CompareTag ("Ground"))
		{
			groundContact = true;
		}
	}

Now to get to the finer details of the jump.

I am quite new to this field.Can you please tell me how can I do the same thing with my code. I also want my sphere to jump again after it touches the ground. Here’s my code.

void Update() 
	{
		if (
			!thrown && (
				(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended ) ||
				Input.GetMouseButtonDown(0) )
		)
		{
			rb.isKinematic = false;
			rb.AddForce (new Vector3(0.0f, 0.5f, 0.2f));
			thrown = true ;

		}
	}
	void OnTriggerEnter(Collider other)
	{ 
		if (other.gameObject.CompareTag ("player")) 
		{
			thrown = true;
		}
	}