About Physics.OverlapXXX things.

Hi
I have a boundingBox and i want to get all colliders that overlap the boundingBox. but there is no method to do this. It is not appropriate to use Physics.OverlapSphere because my collider is box shape. I need Physics.OverlapBox or Physics.OverlapAABB which already exist in PhysX.
I don’t want use OnColliderXXX things because all i need is just get list of collider that overlap the boundingBox or AABB.
Do i have to implement this method? or is there any substitution?

I did a similar thing to what you’re asking, but it looks for a bounding box inside an arbitrarily shaped tetrahedron. Basically I figure out where my points are going, then I make an array of planes, and feed them into Unity - Scripting API: GeometryUtility.TestPlanesAABB

Mind you, I had to be very careful about how I constructed the planes. I only made each plane with 3 Vector3’s, and ordered them so the normal pointed INTO the tetrahedron. If any point out, the testplanesaabb has issues (normal is based off the order that you give the plane constructor each vector3)

tldr: Physics.OverlapAABB == GeometryUtility.TestPlanesAABB

kind of. You can only test against a collider’s bounding box, not the actual collider shape. Also, you have to specify which collider, as you can see from the reference page, so I use physics.overlapsphere to grab any/all colliders that could be within the tetrahedron, and then test to see if they actually are inside it.

Thanks for your reply.
I’m gonna try it out.

Why are you using physics.Overlap?

Cant you use OnCollisionEnter?

For my purposes, I need a constantly changing tetrahedon shape, so no, a collider would not work for my purpose. While kekk says that he’s using a box shape, it is entirely possible that he needs to merely check if something is within a space for a frame or two, rather than making a new gameobject with a collider deal with knowing how to rotate and scale said collider to get each of the vertices in your necessary positions.

Thre is a problem. As this(GeometryUtility.TestPlanesAABB) function name says, it only tests against AABB not OBB, but in my game world there is OBB(a BoxCollider attached to rotated GameObject)
so i think this function is not appropriate for my situation.

I think i have to use OnCollisionEnter unavoidably.