In my game you have to draw a line as close to a wall as you can, so I decided to use queryAABB. However, it comes up with this error:
main.lua:104: calling 'queryAABB' on bad self (b2World expected, got table)
stack traceback:
main.lua:104: in function
Here is my code (I am using "place" instead of "scene" for the event listener):
101. local function lineclose(event)
102. x1 = event.x
103. y1 = event.y
104. local fixtures = b2.World:queryAABB(x1-15,y1-15,x1+15,y1+15)
105. if fixtures > 0 then
106. print ("yes")
107. end
108. end
109. place:addEventListener(Event.MOUSE_UP, lineclose)
Anyone know why this is happening? Thanks! >-
Comments
find somewhere where you do b2.World.new and save it in the variable and use that variable instead