Boxcast vs Raycast Oddities

Weird issue I’m having :

I’m firing a 1 meter large boxcast DOWN towards the ground. It starts 1 meter off the ground and can at a maximum go down 1 meter. (so, it should have a hit distance of 1).
The issue is that the boxcast says the hit distance is .9975, not 1.

A raycast starting at the bottom of the box going the same maximum distance of 1 meter registers a hit distance of 1.
alt text

That makes make me think that the boxcast is starting .0025 meters too low, but the hit.point.y value always equates the raycast even when the distance differs.

In this example, the box/raycast is only .701 meters off the ground. The hit.point.y of both is equal, but the hit.distance differs. Any idea what is going on? Is it just an oversight by me? Thanks
alt text

Boxcast is RED ▉
Raycast is GREEN |

alt textalt text

    void collision()
        RaycastHit boxhit, rayhit;
        Physics.Raycast(new Vector3(0f, 1f, 0f), Vector3.down, out rayhit, 1f);
        Physics.BoxCast(new Vector3(0f, 1.5f, 0f), new Vector3(.5f, .5f, .5f), Vector3.down, out boxhit, Quaternion.identity, 1f);

        Debug.DrawRay(new Vector3(boxhit.point.x, 1f, boxhit.point.z), Vector3.down*boxhit.distance,;
        Debug.DrawRay(new Vector3(0f, 1f, 0f), Vector3.down*rayhit.distance,;
        Debug.Log("boxhit.point.y: " + boxhit.point.y + "    boxhit.distance: " + boxhit.distance);
        Debug.Log("rayhit.point.y: " + rayhit.point.y + "    rayhit.distance: " + rayhit.distance);


I even put in the Physics.Boxcast demo script (which was broken at first, using full size instead of halfExtents). And placing a boxes faces 1 meter apart from each other gives a hit distance of .9975. Is this a bug? So confused.

alt text

    void FixedUpdate()
        //Test to see if there is a hit using a BoxCast
        //Calculate using the center of the GameObject's Collider(could also just use the GameObject's position), half the GameObject's size, the direction, the GameObject's rotation, and the maximum distance as variables.
        //Also fetch the hit data
        m_HitDetect = Physics.BoxCast(, transform.localScale *1/2, transform.forward, out m_Hit, transform.rotation, 1f);
        if (m_HitDetect)
            //Output the name of the Collider your Box hit
            Debug.Log("Hit : " + m_Hit.distance);

Both 2D (Box2D) and 3D (PhysX) use a “contact offset” which provides a buffer zone for collision-detection. This provides a region where a contact is considered touching and is used to provide a stable col-det simulation therefore they return where the collision would happen during normal simulation conditions. Look at positions during normal simulation; objects are not exactly aligned nor do they need to be apart from some sense of “precision”.

Raycasts are not used during standard simulation and are there for miscellaneous use. They are calculate as the exact intersection.