local min_physics_time_step = 0.04 -- ensure physic framerate to be at least 25fps
function love.update(dt)
local dt_left = dt
while dt_left > min_physics_time_step do
world:update(min_physics_time_step)
dt_left = dt_left - min_physics_time_step
end
world:update(dt_left)
-- update other stuff
end
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.
Unfortunately when I test this I get completely out of the blue explosions that send my boxes flying. That code there is equivalent to vrld's original suggestion, which I had exactly the same problem with. I'm not sure why, but cutting out the world:update(left) call stops the explosions (maybe because left is a very small number? )
BlackBulletIV wrote:Unfortunately when I test this I get completely out of the blue explosions that send my boxes flying. That code there is equivalent to vrld's original suggestion, which I had exactly the same problem with. I'm not sure why, but cutting out the world:update(left) call stops the explosions (maybe because left is a very small number? )
All I can think is a scope error making it pass in the wrong value after it loops.
local left = dt
if dt > maxDelta then
while left > maxDelta do
world:update(maxDelta)
left = left - maxDelta
end
world:update(maxDelta)
else
world:update(dt)
end