diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-15 16:24:56 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-15 16:24:56 +0100 |
commit | 94e9860b82688d45c2a00380d55ea3a10b62580a (patch) | |
tree | 4fe668fc62f862fa6de8f0c0532be9d42c1d7c6e /main | |
parent | e1ddd74b23f2accc8dbd27f079561af458cbf04d (diff) | |
parent | 66f7c48e39c6479f11c0dd2426c093b0f2910f76 (diff) |
Merge pull request #65836 from Calinou/add-max-physics-steps-per-frame-setting
Implement adjusting the maximum number of physics steps per rendered frame
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/main.cpp b/main/main.cpp index 0a8de56e01..91d38ff6d9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1789,6 +1789,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_ticks_per_second", PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second", PROPERTY_HINT_RANGE, "1,1000,1")); + + Engine::get_singleton()->set_max_physics_steps_per_frame(GLOBAL_DEF("physics/common/max_physics_steps_per_frame", 8)); + ProjectSettings::get_singleton()->set_custom_property_info("physics/common/max_physics_steps_per_frame", + PropertyInfo(Variant::INT, "physics/common/max_physics_steps_per_frame", + PROPERTY_HINT_RANGE, "1,100,1")); + Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5)); Engine::get_singleton()->set_max_fps(GLOBAL_DEF("application/run/max_fps", 0)); ProjectSettings::get_singleton()->set_custom_property_info("application/run/max_fps", @@ -3105,7 +3111,7 @@ bool Main::iteration() { last_ticks = ticks; - static const int max_physics_steps = 8; + const int max_physics_steps = Engine::get_singleton()->get_max_physics_steps_per_frame(); if (fixed_fps == -1 && advance.physics_steps > max_physics_steps) { process_step -= (advance.physics_steps - max_physics_steps) * physics_step; advance.physics_steps = max_physics_steps; |