1 decade ago by Seeders
Everywhere I try to find how to query for entities in my world, people say use the world.QueryAABB(callback,aabb), but box2djs doesn't seem to have that.
All I seem to have is
Which I can't get to return anything but 0.
entitiesInRange is 0. And even if it was non-zero, how would I have access to the bodies found in the query? Would they be in my array? Why do I have to set a maxCount? This function just doesn't make any sense to me..
All I seem to have is
ig.world.Query = function (b,c,d){var e=new Array(d);b=this.m_broadPhase.QueryAABB(b,e,d);for(d=0;d<b;++d)c[d]=e[d];return b}
Which I can't get to return anything but 0.
var aabb = new b2.AABB(); aabb.lowerBound.Set(this.pos.x - 50, this.pos.y - 50); aabb.upperBound.Set(this.pos.x + 50, this.pos.y + 50); var myArray = new Array(10); var entitiesInRange = ig.world.Query(aabb, myArray, 10);
entitiesInRange is 0. And even if it was non-zero, how would I have access to the bodies found in the query? Would they be in my array? Why do I have to set a maxCount? This function just doesn't make any sense to me..