question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

World.step is buggy when attempting to account for variable framerate

See original GitHub issue

When passing a timeSinceLastCalled value to the world.step method, the simulation performance quickly degrades beyond usability.

Example usage: Cannon demo

cannon.js issue 371

Article: Fix your timestep

Spectrum chat: World step does not adapt to framerate

Per Schteppe (schteppe#371):

Perhaps the number of substeps are maxed out? This could happen if you, for example, pass in deltaTime in milliseconds instead of seconds… or if you accidentally calculate the value wrong for the first frame (there is no “previous” time value). or if the first deltaTime values are too large (they usually are larger during the first frames while the JIT is warming up). What happens if you pass in 1000 substeps instead of 10? If you have implemented it correctly, changing the number of substeps should do nothing.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
Platanecommented, Apr 8, 2020

yes it seems so, although it also brings questionable features ( “timeSinceLastCalled = -1 instead of 0” )

I am not sure this address the cube freezing midair effect, I am looking into that.

1reaction
codynovacommented, Apr 10, 2020

~This looks good and is working well now except for the freezing cubes (no framerate degradation in my testing). We should wait to merge until that issue is resolved.~

I agree with Marco regarding API changes, we should strive to make as few API changes as possible, and maintain backwards compatibility where we can.

@Platane Great work on this so far, I think supporting variable framerate would be a huge feature.

EDIT: I spoke too soon regarding framerate performance

Read more comments on GitHub >

github_iconTop Results From Across the Web

World.step() doesn't make sense · Issue #371 - GitHub
The frame-rate doesn't drop, everything just starts moving in slow-motion, ... World.step is buggy when attempting to account for variable ...
Read more >
Fixed time step or variable time step? Delta time or no? - Reddit
I'm making a game in C++ with SDL and currently my game has a very simple fixed time step implementation that's locked in...
Read more >
Rotobrush:Frame rate mismatch - Adobe Support Community
It's kinda buggy but it works. Go up to composition and click composition settings. Change the frame rate to whatever the error told...
Read more >
How do games handle the issues of variable frame rate game ...
Problem arises when you try to scale the variables in proportion to real frame rate (such as gravity and vx) so that time...
Read more >
Frame Rate Independence - Real-Time Physics Simulation ...
I'm having some trouble achiving frame rate independence from my physics simulation: I've tried both: Code: Select all // Variable time step ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found