aabbQuery method
Returns all the bodies within an AABB.
result
An array to store resulting bodies in.
Implementation
@override
List<Body> aabbQuery(World world, AABB aabb, [List<Body>? result]){
result ??= [];
for (int i = 0; i < world.bodies.length; i++) {
final b = world.bodies[i];
if (b.aabbNeedsUpdate) {
b.updateAABB();
}
// Ugly hack until Body gets aabb
if (b.aabb.overlaps(aabb)) {
result.add(b);
}
}
return result;
}