Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am stuck on it:how can i count or find the no.of bodies present in any area in as3?would be thankful if any guys help me out.....

share|improve this question
Box2D must have some sort of spatial partitioning, such as a quadtree. You should be able to query that partitioning to determine what objects are inside of a selection. – Jon Oct 15 '12 at 11:04

Create a fixture which has the exact size as the desired area, set the fixture's sensor property to true and check the number of collisions which include the sensor fixture.

You can find more about sensor fixtures in the official box2d documentation

share|improve this answer
thanks for the help... – user1489553 Oct 15 '12 at 9:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.