Difference between revisions of "B2.World:queryAABB"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 +
'''<translate>Class</translate>:''' [[Special:MyLanguage/b2.World|b2.World]]<br/>
 
=== <translate>Description</translate> ===
 
=== <translate>Description</translate> ===
 
<translate><br />
 
<translate><br />

Revision as of 10:27, 24 August 2018

Available since: Gideros 2011.6
Class: b2.World

Description


Query the world for all fixtures that potentially overlap the provided AABB.

(table) = b2.World:queryAABB(minx,miny,maxx,maxy)

Parameters

minx: (number) the minimal x coordinate of the query box
miny: (number) the minimal y coordinate of the query box
maxx: (number) the maximal x coordinate of the query box
maxy: (number) the maximal y coordinate of the query box

Return values

Returns (table) Indexed array of fixtures that potentially overlaps the provided AABB

Examples

Query specific area for bodies

--get all fixtures in this area
local fixtures = world:queryAABB(0, 0, 100, 10)
--check if there are any fixture
if #fixtures > 0 then
	for i = 1, #fixtures do
		--getting body of fixture
		local body = fixtures[i]:getBody()
	end
end