Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryAABB only returns one overlapping fixture #39

Open
GoogleCodeExporter opened this issue Aug 24, 2015 · 1 comment
Open

QueryAABB only returns one overlapping fixture #39

GoogleCodeExporter opened this issue Aug 24, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create multiple single-fixture rectangular bodies (using SetAsBox) in the 
world.
2. Call QueryAABB, passing it a callback and an AABB centred at the location of 
one of the bodies and with a size sufficient to overlap several bodies.
3. The callback is only called once for the first overlapping fixture found, no 
matter how many fixtures are intersecting with the defined AABB.

What is the expected output? What do you see instead?

I'm expecting the callback to be called once for each fixture that the AABB 
overlaps.

What version of the product are you using? On what operating system?
2.1a.3 on OSX

Please provide any additional information below.

If I manually loop through the bodies and do the AABB check myself, everything 
works as I expect. I'm not sure what is going on with the QueryAABB function.

Original issue reported on code.google.com by michael....@verold.com on 26 Mar 2013 at 6:59

@GoogleCodeExporter
Copy link
Author

For run callback function for each found object, you must return true in your 
callback function.

Example for me (JavaScript):
world.QueryAABB(function(fixture) {
    // Some code
}, aabb);
In this example, callback function will be called only once (but i know that i 
have two bodies at this point)

world.QueryAABB(function(fixture) {
    // Some code
   return true;
}, aabb);
// If we put return true in callback, this function will be called again for 
each found object. In my example function was called second times because i 
have two bodies.

Original comment by v.za...@wippo.md on 9 Jul 2015 at 10:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant