MCPcopy Create free account
hub / github.com/axmolengine/axmol / update

Method update

tests/cpp-tests/Source/Box2DTest/Box2dTest.cpp:296–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void Box2DTest::update(float dt)
297{
298 // It is recommended that a fixed time step is used with Box2D for stability
299 // of the simulation, however, we are using a variable time step here.
300 // You need to make an informed choice, the following URL is useful
301 // http://gafferongames.com/game-physics/fix-your-timestep/
302
303 int velocityIterations = 8;
304 int positionIterations = 1;
305
306 // Instruct the world to perform a single step of simulation. It is
307 // generally best to keep the time step and iterations fixed.
308 world->Step(dt, velocityIterations, positionIterations);
309
310 // Debug draw
311 if (showDebugDraw)
312 {
313 drawBox2D->clear();
314 world->DebugDraw();
315 }
316}
317
318void Box2DTest::onTouchesEnded(const std::vector<Touch*>& touches, Event* event)
319{

Callers

nothing calls this directly

Calls 3

StepMethod · 0.45
clearMethod · 0.45
DebugDrawMethod · 0.45

Tested by

no test coverage detected