When using Body:setAngularVelocity(n) it starts my Body rotating.
I was expecting passing 0 would cause it to stop rotating ?
Has anyone else experienced this? or am I using this func wrong
Body:setAngularVelocity(0) isnt doing what I expected
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Body:setAngularVelocity(0) isnt doing what I expected
Works for me:
No idea what you're doing, so I can't say more.
Code: Select all
local world = love.physics.newWorld(0, 0, false)
local body = love.physics.newBody(world, 0, 0, "dynamic")
local shape = love.physics.newRectangleShape(200, 150)
love.physics.newFixture(body, shape)
function love.update(dt)
world:update(dt)
end
function love.keypressed(k)
if k == "a" then
body:setAngularVelocity(-math.pi)
end
if k == "s" then
body:setAngularVelocity(0)
end
if k == "d" then
body:setAngularVelocity(math.pi)
end
if k == "escape" then love.event.quit() end
end
function love.draw()
love.graphics.translate(400.5,300.5)
love.graphics.polygon("line", body:getWorldPoints(shape:getPoints()))
end
Who is online
Users browsing this forum: Google [Bot] and 67 guests