I threw something quick and extremely crude together in order to test the issue:
Code: Select all
phys=love.physics.newWorld(0,500)
love.physics.setMeter(8)
function love.load()
ents={}
local ent={}
ent.body=love.physics.newBody(phys,0,0,"dynamic")
ent.body:isFixedRotation(true)
ent.body:setPosition(60,0)
ent.shape=love.physics.newRectangleShape(16,16)
ent.fixture=love.physics.newFixture(ent.body,ent.shape)
ent.fixture:setFriction(0)
ent.fixture:setRestitution(0)
table.insert(ents,ent)
local ent={}
ent.body=love.physics.newBody(phys,0,0,"static")
ent.body:isFixedRotation(true)
ent.body:setPosition(50,100)
ent.shape=love.physics.newRectangleShape(16,16)
ent.fixture=love.physics.newFixture(ent.body,ent.shape)
ent.fixture:setFriction(0)
ent.fixture:setRestitution(0)
table.insert(ents,ent)
end
function love.update(dt)
phys:update(dt)
end
function love.draw()
for i,v in pairs(ents) do
local px,py=v.body:getPosition()
local x1,y1,x2,y2,x3,y3,x4,y4=v.shape:getPoints()
love.graphics.polygon("fill",{x1+px,y1+py,x2+px,y2+py,x3+px,y3+py,x4+px,y4+py})
end
end