Page 1 of 1

PolygonShape size issues?

Posted: Fri Mar 07, 2014 5:56 pm
by LilaQ
Hey guys,

currently I'm experiencing some troubles with newPolygonShape()

e.g.

Code: Select all

test = love.physics.newPolygonShape(0,0,0,3,3,3,3,0)
Does not work, gives "Box2D assertion failed: false" error

Code: Select all

test = love.physics.newPolygonShape(0,0,0,4,4,4,4,0)
Does work.

It seems height/width of a PolygonShape have to be > 3 to work. But if I try to make a smaller Shape like this:

Code: Select all

test = love.physics.newRectangleShape(0.000001, 0.0001)
there is no problem at all.

Anyone has an explanation to this? Or even better, a solution? For my project I need to be able to make small PolygonShapes...

Thanks in advance!

LilaQ

Re: PolygonShape size issues?

Posted: Fri Mar 07, 2014 6:03 pm
by slime
Try making the meter size smaller (with [wiki]love.physics.setMeter[/wiki].)

EDIT: For those wondering why this happens, box2d's newPolygonShape function will merge vertices which are very close to each other (in terms of box2d's meters). If you decrease the meter size, it means the vertices you specify are further apart to box2d.

Re: PolygonShape size issues?

Posted: Fri Mar 07, 2014 6:32 pm
by LilaQ
Nice, that did the trick.

Thanks slime!