Today i decided to replace sprite:hitTestPoint () with more interesting box2d feature - b2.World:queryAABB(lowerx, lowery, upperx, uppery) and here the surprise i got. For point A /look at the diagram/ i have correct return - a nil but for point B i have incorrect return - the fixture next to the point. Black lines are hint where incorrect results happen. b2 query is done over a box not the actual fixture. Any suggestions or i did something wrong?
Comments
function OnTouchesEnd(e)
gx,gy=stage:globalToLocal(e.x,e.y)
pickfixtures=cloud_world:queryAABB(gx-2, gy-2, gx+2, gy+2)
print(pickfixtures[1])
end
It seems the description is a bit misleading. Now i need some other way to check if click is inside the fixture.
Can you use TNT Collision engine and check for a point inside figure?
Also you can enable AABB drawing with:
And i used points to show where things work /its my bad/ actually they are squares 4 by 4 pixels but it doesn't make any difference.
So the performance difference is noticeable?
http://www.giderosmobile.com/forum/discussion/1939/tnt-collision-engine-released- :-)