love.physics.newPolygonShape troubles
Posted: Wed Jun 09, 2010 5:50 am
I'm trying to draw a polygon with arbitrary coordinate values but it won't show up and isn't detected when the player goes past it (no collision). The coordinate values are:
They're stored in a table called collCoordsTable.
I've placed a body for it in a position such that it basically falls in the middle of the four sets of coordinates. Then I do:
I draw a line for the boundary box but nothing is draw:
The player shape and all other various shapes show just fine, their boundary boxes show and their bodies are collidable, just not this polygon. Any ideas why? If you need more info let me know.
Code: Select all
923, 475, 923, 411, 1157, 411, 1157, 475
I've placed a body for it in a position such that it basically falls in the middle of the four sets of coordinates. Then I do:
Code: Select all
collision_test1 = {}
collision_test1.body = love.physics.newBody(world, _body_x, _body_y)
collision_test1.shape = love.physics.newPolygonShape(collision_test1.body, unpack(collCoordsTable))
collision_test1.shape:setData("collision_test1")
Code: Select all
love.graphics.polygon('line', collision_test1.shape:getBoundingBox())