Page 1 of 1

Love Physics Polygon Creation[Resolved]

Posted: Sat May 11, 2013 12:52 pm
by XOdysseusX
Hi. I'm posting here because I'm trying to make a Polygons shape with love.physics, but it just refuses to work.

As a way of trouble shooting, I'm only looking to be able to draw a 10x10 square with love.physics.newRectangleShape

CODE: SELECT ALL
self.shape = love.physics.newPolygonShape(0, 0, 10, 0, 10, 10, 0, 10)
--self.shape = love.physics.newRectangleShape(10, 10)


Both lines of code should technically achieve the same thing, but only the latter works.
Check it out yourself if you're interested. The code is in actor.lua.

Re: Love Physics Polygon Creation

Posted: Tue May 14, 2013 2:58 am
by XOdysseusX
Bump.

Can anybody help me help you help me?

Re: Love Physics Polygon Creation

Posted: Tue May 14, 2013 3:58 am
by markgo
Hi Odysseus. The newRectangleShape function creates a rectangle centered around x,y. For your example, the rectangle would be centered around 0,0. The newPolygonShape function creates a rectangle with its top left corner at 0,0. You'll want to offset your polygon by (-5,-5). I've added this note to the wiki. Good luck.

Re: Love Physics Polygon Creation

Posted: Fri May 17, 2013 2:06 am
by XOdysseusX
Thanks for the support markgo! :awesome: