OnCollisionStay being called when there is no collision

I have a default plane and a default capsule with a default rigidbody on it.

The rigidbody has this script on it
Click for code

using UnityEngine;

public class Jump : MonoBehaviour
{
    public TestCast testCast;

    bool grounded;
    Rigidbody myRigidbody;

    void Awake()
    {
        myRigidbody = gameObject.GetComponent<Rigidbody>();
    }

    void FixedUpdate()
    {
        myRigidbody.WakeUp();

        if(grounded)
        {
            Debug.Log("FrameCount = " + Time.frameCount + " FixedTime = " + Time.fixedTime + "___ Type = FixedUpdateJump ___ Rigidbody.y = " + myRigidbody.position.y);
            myRigidbody.AddForce(Vector3.up * 1000, ForceMode.VelocityChange);
            grounded = false;
        }
    }

    void OnCollisionStay(Collision collisionInfo)
    {
        Debug.Log("FrameCount = " + Time.frameCount + " FixedTime = " + Time.fixedTime + " ___ Type = OnCollisionStay ___ Rigidbody.y = " + myRigidbody.position.y);
        testCast.DoRaycast();
        grounded = true;
    }
}

The “TestCast” script is this

using UnityEngine;
using System.Collections;

public class TestCast : MonoBehaviour
{
    public void DoRaycast()
    {
        RaycastHit hitInfo;
        if(Physics.Raycast(transform.position, transform.forward, out hitInfo))
        {
            Debug.Log("Hit");
        }else{
            Debug.Log("No Hit");
        }
    }
}

The rigidbody is to drop, detect the collision, and then jump.

When I hit play, the result is this
Click for image

2267190--151832--Console.png

We see that a collision is detected, a jump is done, and then another collision is detected, but the rigidbody.y is at this point waaay above the floor. Also, by doing a test raycast with an object that is on the floor pointing to where the capsule would be colliding, we see that it detects a hit the first time, but not the second, even though it was being called within the oncollisionstay method.
This tells me that the rigidbody and the collider is being updated, but it seems that either this is a bug, or that maybe OnCollisionStay collision detection is being delayed in some way so that it doesnt actually match what the rigidbody is doing.

Does anyone know if this is the intentional way for things to work?
Physics is so tricky to work with >.>
I included a sample project in case anyone wanted to test it.

P.S. - Please dont give me advise on how to do a jump script. I was only using this as an example.

2267190–151833–CollisionErrorPackage.unitypackage (6.23 KB)

I’m having the exact same problem. Did you ever figure this out?

I posted that a long time ago, so unfortunately I dont remember much of this, but I dont recall finding an answer.
I am not at my computer at the moment, but my guess would be that OnCollisionStay gets called when OnCollisionEnter and OnCollisionExit are also called. So this finale OnCollisionStay call might have been due to the OnCollisionExit firing. Didnt test any of that though =).