Physics.OverlapBoxNonAlloc

Here’s what I want to do:
I have a collider (box, capsule or sphere) and I want to perform an OverlapBox using collider.bounds.size, and the bounds.center.

This is what I have tried:

Physics.OverlapBoxNonAlloc(grabbingObj.rootTransform.TransformPoint(bounds.center), grabbingObj.rootTransform.TransformVector(bounds.extent), colliders, Quaternion.identity, layermask.value);

but it doesn’t give me the right box. I know the Physics.OverlapBox works because if I were to just use transform.position, Vector3.One I get a hit.

How do I properly convert collider bounds into a OverlapBox?

Thanks!

In case anyone else have this problem, You have to use collider.size * 0.5f (extents) and convert collider.center to world space. This mean the collider has to be a box collider.

If you use bound you will have orientation issues like I did. Probably there’s a way to use bounds but I was not able to figure it out.

Vector3 center =rootTransform.TransformPoint(boxCollider.center);
    
Physics.OverlapBoxNonAlloc(center, collider.size* 0.5f , colliders, rootTransform.rotation, internalSettings.interactionsLayerMask.value)