1. rude
  2. love

Issues

Issue #617 invalid

newRectangleShape not using correct points?

Minh Ngo
created an issue

Uncomment the rectangle constructor and see that it doesn't draw the square at the same location as the polygon constructor.

I believe it may be related to this gentleman's problem: https://love2d.org/forums/viewtopic.php?f=4&t=33652

world = love.physics.newWorld(0,100)

shape = love.physics.newPolygonShape(0, 0, 10, 0, 10, 10, 0, 10)

-- shape = love.physics.newRectangleShape(10, 10)

body = love.physics.newBody(world, 0, 0, "dynamic")

fixture = love.physics.newFixture(body, shape)

love.physics.setMeter(100)      

function love.update(dt) world:update(dt) end

function love.draw() love.graphics.polygon('fill',body:getWorldPoints(shape:getPoints())) end

Comments (4)

  1. Minh Ngo reporter

    Well I just learned that newRectangleShape creates a rectangle centered at x,y instead of its top left corner. I'll add the note to the wiki.

  2. Log in to comment