Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.