Detecting collisions for jumping.

I’m trying to make my character jump if i press space while on the ground. To check if i’m on the ground, i have a small box, with the width of my character lying under the player’s feet. i want to check if the box is colliding with an object to determine whether or not the player is touching the ground.
From what i can tell from research, i need to be using the OnCollisionStay function, so i’ve set it up here and attached it to my box.

    public GameObject player;

    private Rigidbody rb;

    void Start() {
        rb = player.gameObject.GetComponent<Rigidbody> ();
    }

    void OnTriggerStay(){
        if (Input.GetKeyDown ("Space")) {
            rb.AddForce(0,500,0);
        }
    }

This code doesn’t work, and i’m not sure why. Can someone point out what i might be doing wrong? My logic is that as long as the the box is colliding with something, the code will check if i’m pressing space and shoot my character upwards. I’ve attached the player gameobject to the player variable via the inspector.
Note: i’ve tried using raycasts but it didn’t work so well on ledges since the player’s center needs to be touching the ground.

Since i posted this i’ve worked around it by using OnTriggerEnter and OnTriggerExit to toggle a boolean which i use to determine if i’m grounded or not. However, if someone can still tell what’s wrong with the code above that’d be great.
Here’s what my work around code looks like if anyone else has this problem

    void OnTriggerEnter(Collider target){
        if (target.tag != "Player") {
            Debug.Log ("Enter");
            grounded = true;
        }
    }
    void OnTriggerExit(Collider target){
        if (target.tag != "Player") {
            Debug.Log ("Exit");
            grounded = false;
        }
    }
    void Update(){
        Debug.Log (grounded);
        if (grounded == true) {
            if (Input.GetKeyDown ("space")) {
                rb.AddForce (0, 500, 0);
            }
        }
    }

In the first code example you are using OnTriggerStay instead of OnCollisionStay is this intended?

Try to change Sleeping mode on your Rigidbody to “Never Sleep”,
I played around with this a little bit, although I used 2D objects. I noticed that the OnCollisionStay2D would work for a second and then it would stop. The issue for me was that my object was sleeping.