Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private float accumulator = 0;
- // when setting up the world
- world.setAutoClearForces(false);
- @Override
- public void update(float delta) {
- float step = 1 / 60f; // the duration of each timestep
- accumulator += delta;
- while(accumulator - step >= 0) {
- accumulator -= step;
- world.step(step, 8, 3);
- }
- world.clearForces();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement