How to detect if a geom is inside another geom ?

Jan 21, 2010 at 7:27 PM
Edited Jan 21, 2010 at 7:34 PM

I need to detect when a geom has been pushed inside another.

Is there a simple way to do this ?

Thanks.

Coordinator
Jan 21, 2010 at 8:27 PM

I deleted your second post, I hope you don't mind.

Geometries should not get stuck in each other. The purpose of the engine is to separate the geometries from each other. In case you are using collision groups or other means of filtering, you can check if the AABB belonging to the geometry is inside the other geometry's AABB. It should be sufficient if you need to check something like a bullet inside something.

 

 

Jan 21, 2010 at 8:46 PM

It shouldn't, I agree.

But sometime it does. And I want to detect and correct it.

I will look into AABB.

Thanks.

 

Jan 22, 2010 at 2:22 PM

Can you offer some insights on how to do it with AABB ?

Would it also work for circular bodies ?

Thanks.

 

Coordinator
Jan 22, 2010 at 7:06 PM

Inside the FPE 3.0 source tree (in the source control), there is an AABB.Contains() method that takes in an AABB. That should get you started.

And yes, it works on all kinds of geometries - all of them have an AABB that contains the whole geometry.