Fixed timestep.

This commit is contained in:
ViktorLjung
2014-04-16 14:38:26 +02:00
parent cf6e16222a
commit 0338a06836
+7 -1
View File
@@ -68,7 +68,13 @@ void Systems::PhysicsSystem::RegisterComponents(ComponentFactory* cf)
void Systems::PhysicsSystem::Update(double dt)
{
m_PhysicsWorld->stepDeltaTime(0.0166f);
static const double timestep = 1 / 60.0;
m_Accumulator += dt;
while (m_Accumulator >= timestep)
{
m_PhysicsWorld->stepDeltaTime(timestep);
m_Accumulator -= timestep;
}
// Step the visual debugger
StepVisualDebugger();