using Physics.Checkbox is it buggy or just few docmutation on how to use it?

Hi, I tried using Physics.Checkbox since it seemed the easiest way to perform the check I needed but it never worked tried many parameters I always get FALSE for collision detection. even if the object is overlapping an object an other object. for performance and simplicity of code used I am trying to make it with this approach avoid raycasts,enter/exit collision. Specially with new InputSystem the oldway to do checking needs more round trips in my case.

public static bool CheckBox(Vector3 center, Vector3 halfExtents, Quaternion orientation = Quaternion.identity, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

parameters I used to test:

Vector3 center = _bc.bounds.center;
Vector3 halfExtents =
[INDENT] new Vector3(_bc.bounds.center.x,_bc.bounds.min.y,_bc.bounds.center.z);
 new Vector3(_bc.bounds.size.x / 4, _bc.bounds.size.y / 4, _bc.bounds.size.z / 4);
 new Vector3(transform.localScale.x / 2, transform.localScale.y / 4, transform.localScale.z / 4);[/INDENT]
Quaternion orientation =
               Quaternion.identity;
                transform.rotation;
int layermask = 9;
QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGloba

I always get false no matter what I put in params specially the half extent vector3 one
if anyone can help thanks.

Solved: Physics.CheckBox(_boxcollider.bounds.center,_boxcollider.bounds.size/2,transform.rotation, groundSlope)
wrong assumption that there is no vector division in unity :stuck_out_tongue: Actually, Unity seems to handle it internally on it own way vector/float is ok in Unity. groundSlope is the layer where collision should be checked. I am happy camper, 4 lines of code jumping and no double Jump allowed :slight_smile:

1 Like