Love Physics Polygon Creation[Resolved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
XOdysseusX
Prole
Posts: 11
Joined: Fri Apr 26, 2013 3:32 pm

Love Physics Polygon Creation[Resolved]

Post 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.
Attachments
Mission100.love
(317.08 KiB) Downloaded 131 times
Last edited by XOdysseusX on Fri May 17, 2013 2:06 am, edited 1 time in total.
XOdysseusX
Prole
Posts: 11
Joined: Fri Apr 26, 2013 3:32 pm

Re: Love Physics Polygon Creation

Post by XOdysseusX »

Bump.

Can anybody help me help you help me?
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: Love Physics Polygon Creation

Post 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.
XOdysseusX
Prole
Posts: 11
Joined: Fri Apr 26, 2013 3:32 pm

Re: Love Physics Polygon Creation

Post by XOdysseusX »

Thanks for the support markgo! :awesome:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 7 guests