Comments (2)
Hello,
This is a known issue. Currently the sample app uses the VSYNC to display frames but it uses a fixed time step of 60 Hz to simulate physics. I didn't want to implement any interpolation to go to a higher frequency as then you wouldn't see the exact output of the physics engine anymore and I also didn't want to support a variable delta time since that messes with the determinism of the simulation.
In the menu "Physics Settings" / "Update Frequency" you can set the fixed tick rate and if you match it to your monitors refresh rate you should get a simulation that runs normal.
I think I will implement a change that just delays the rendering of the next frame until 1/60th of a second has passed since the last frame to fix things for high frequency monitors.
from joltphysics.
I have a limited understanding about how the samples work, keep this in mind.
From what I can tell the driver to all the samples is the class SamplesApp
located in Samples/SamplesApp.cpp
, in this file we have the following method:
JoltPhysics/Samples/SamplesApp.cpp
Line 2374 in b622c59
Open this up, and go down a few lines, you'll see that they define delta_time
as 1/mUpdateFrequency
and use that to update the physics system.
which uses mUpdateFrequency
which is defined in the header file:
JoltPhysics/Samples/SamplesApp.h
Line 90 in b622c59
Thus from what I've seen you're correct about these samples being frame rate dependent. In order to fix this we would need to a method to come up with a dynamic delta_time
based on how much time has passed since the last physics update.
When scrolling through SamplesApp.cpp
I thought I might have seen code which can control the update frequency with a slider. If this is true, then perhaps you can use a slider to choose an update frequency which will make the samples not "fast" on your computer. Otherwise you can always hardcode a value for your update frequency and recompile.
If you actually wanted frame independent simulation Glen has a good article on this: https://gafferongames.com/post/fix_your_timestep/ and I have an implementation of this on my site here: https://cuppajoeman.com/toolbox/game_dev/game_loop/.
Not sure what your experience is with contributing and c++, but I think the best case could be to have an option which can enable frame independent simulation in the samples app, which could be contributed via a pull request.
from joltphysics.
Related Issues (20)
- Avoid setting CMake configuration types as a subproject HOT 9
- `CylinderShape` vs `MeshShape` yields odd collision data HOT 4
- Placement new with Jolt allocators HOT 2
- GCC 13.2: warning: ISO C++ prohibits anonymous structs [-Wpedantic] HOT 2
- Some userdata variables are still uint32_t HOT 2
- Support multiple collisions per vertex for a soft body
- CharacterContactListener: add OnContactPersisted and OnContactRemoved HOT 3
- Should DecoratedShapeSettings allow for raw pointers in its constructor? HOT 3
- Epsilon values in asserts causing issues in Debug builds HOT 9
- Automatic transmission HOT 2
- Crash in SkeletonMapperTest sample HOT 3
- [MSVC] Internal compiler error
- Compile error on Sample project HOT 5
- [Question] I intergrate JoltPhysics into my project with exception thrown HOT 1
- Is it possible to cast sphere ? HOT 2
- Misaligned ABI when using JPH_DOUBLE_PRECISION causes a problem on the VirtualCharacter HOT 13
- Slow HeightfieldShape Save/RestoreBinaryState HOT 2
- Poor performance with high amount of static colliders HOT 1
- Documentation: Syntax is not valid for JPH::ConvexHullShapeSettings HOT 2
- Weird issue with virtual character controller not hitting the ground in Firefox Emscripten HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joltphysics.