Hey Guys,
I have been working on a flash game, and we are almost done, but I ran into an issue with stepping, that is why I am posting it here.
In the game I have made it so that the frame rate can be adjusted. To keep things running at the same speed, when I modify the frame rate, I have to change the time step, the issue I am having is that when the time step gets too large, accuracy seems to be lost. It's not a massive loss, but its enough to cause problems in a situation where something is just small enough to jump over. I figured out a solution but it feels hacky to me.
What I did to solve the issue, was I shrank the size of the time step, and then stepped more then once on each frame. For instance at 40 fps, my time step is 1.32/40, in my main loop I made it do this:
However, the problems only begin at a frame rate of 25 or lower so:
I might be missing a setting I can change to fix this issue, logic tells me that one step of 0.0538 should be the same as two steps of 0.0538/2, what am I missing?
I have been working on a flash game, and we are almost done, but I ran into an issue with stepping, that is why I am posting it here.
In the game I have made it so that the frame rate can be adjusted. To keep things running at the same speed, when I modify the frame rate, I have to change the time step, the issue I am having is that when the time step gets too large, accuracy seems to be lost. It's not a massive loss, but its enough to cause problems in a situation where something is just small enough to jump over. I figured out a solution but it feels hacky to me.
What I did to solve the issue, was I shrank the size of the time step, and then stepped more then once on each frame. For instance at 40 fps, my time step is 1.32/40, in my main loop I made it do this:
Code:
var m_timestep:Number = 1.32/40
world.Step(m_timestep/2, 1);
world.Step(m_timestep/2, 10);
world.Step(m_timestep/2, 1);
world.Step(m_timestep/2, 10);
However, the problems only begin at a frame rate of 25 or lower so:
Code:
var m_timestep:Number = 1.32/25
world.Step(m_timestep/2, 1);
world.Step(m_timestep/2, 10);
world.Step(m_timestep/2, 1);
world.Step(m_timestep/2, 10);
I might be missing a setting I can change to fix this issue, logic tells me that one step of 0.0538 should be the same as two steps of 0.0538/2, what am I missing?