This project has moved. For the latest updates, please go here.

Quick detection of one fixture inside another

Topics: User Forum
Dec 9, 2010 at 6:55 PM

Hey, I've been working on a game that requires being split into two parts. The first part there are no physics at all. The second part adds all the physics into the game. You have to click a button to make a square. Then you can drag and drop the square anywhere you want on the screen.

The issue I'm having is preventing fixtures from laying on top of each other. After you let go of a fixture it becomes static. While holding it, it is dynamic. Is there a way i can quickly check for touching sides/area in the fixtures?


Dec 9, 2010 at 11:34 PM

All the tools to check for intersection between polygons (and circles) are inside the static Collision class. You could take a look at the Testbed test called PolyCollisionTest. It shows you how to use the Collision class.

Dec 10, 2010 at 5:00 PM

What if I'm currently using Fixtures for most of my objects. It seems like there is a lot more clutter using Polygon shapes. Also, I'm going to need it to check more than just two shapes to each other. I guess i could put the shapes into a list and for loop it, but that would seem to take up more work. 

Dec 12, 2010 at 12:18 AM

Fixtures are a placeholder for a shape and a body. If you have fixtures, you already have the shape.