This project has moved and is read-only. For the latest updates, please go here.

How to detect if a geom is inside another geom ?

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

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

Is there a simple way to do this ?


Jan 21, 2010 at 9: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 9:46 PM

It shouldn't, I agree.

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

I will look into AABB.



Jan 22, 2010 at 3:22 PM

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

Would it also work for circular bodies ?



Jan 22, 2010 at 8: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.