diff --git a/core/config/engine.cpp b/core/config/engine.cpp
index 3ffd8ee46b7..495670bc884 100644
--- a/core/config/engine.cpp
+++ b/core/config/engine.cpp
@@ -37,12 +37,12 @@
#include "core/version.h"
#include "core/version_hash.gen.h"
-void Engine::set_iterations_per_second(int p_ips) {
+void Engine::set_physics_ticks_per_second(int p_ips) {
ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0.");
ips = p_ips;
}
-int Engine::get_iterations_per_second() const {
+int Engine::get_physics_ticks_per_second() const {
return ips;
}
diff --git a/core/config/engine.h b/core/config/engine.h
index 3b3e5825b2d..e6b5df2d5ac 100644
--- a/core/config/engine.h
+++ b/core/config/engine.h
@@ -78,8 +78,8 @@ private:
public:
static Engine *get_singleton();
- virtual void set_iterations_per_second(int p_ips);
- virtual int get_iterations_per_second() const;
+ virtual void set_physics_ticks_per_second(int p_ips);
+ virtual int get_physics_ticks_per_second() const;
void set_physics_jitter_fix(double p_threshold);
double get_physics_jitter_fix() const;
diff --git a/core/core_bind.cpp b/core/core_bind.cpp
index 76c918a92f7..f3f51e57ee2 100644
--- a/core/core_bind.cpp
+++ b/core/core_bind.cpp
@@ -2077,12 +2077,12 @@ void _ClassDB::_bind_methods() {
////// _Engine //////
-void _Engine::set_iterations_per_second(int p_ips) {
- Engine::get_singleton()->set_iterations_per_second(p_ips);
+void _Engine::set_physics_ticks_per_second(int p_ips) {
+ Engine::get_singleton()->set_physics_ticks_per_second(p_ips);
}
-int _Engine::get_iterations_per_second() const {
- return Engine::get_singleton()->get_iterations_per_second();
+int _Engine::get_physics_ticks_per_second() const {
+ return Engine::get_singleton()->get_physics_ticks_per_second();
}
void _Engine::set_physics_jitter_fix(double p_threshold) {
@@ -2187,8 +2187,8 @@ bool _Engine::is_printing_error_messages() const {
}
void _Engine::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second);
- ClassDB::bind_method(D_METHOD("get_iterations_per_second"), &_Engine::get_iterations_per_second);
+ ClassDB::bind_method(D_METHOD("set_physics_ticks_per_second", "physics_ticks_per_second"), &_Engine::set_physics_ticks_per_second);
+ ClassDB::bind_method(D_METHOD("get_physics_ticks_per_second"), &_Engine::get_physics_ticks_per_second);
ClassDB::bind_method(D_METHOD("set_physics_jitter_fix", "physics_jitter_fix"), &_Engine::set_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("get_physics_jitter_fix"), &_Engine::get_physics_jitter_fix);
ClassDB::bind_method(D_METHOD("get_physics_interpolation_fraction"), &_Engine::get_physics_interpolation_fraction);
@@ -2225,7 +2225,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_hint"), "set_editor_hint", "is_editor_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_error_messages"), "set_print_error_messages", "is_printing_error_messages");
- ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_ticks_per_second"), "set_physics_ticks_per_second", "get_physics_ticks_per_second");
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "time_scale"), "set_time_scale", "get_time_scale");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
diff --git a/core/core_bind.h b/core/core_bind.h
index 8736e6ffd8e..9060aff3401 100644
--- a/core/core_bind.h
+++ b/core/core_bind.h
@@ -623,8 +623,8 @@ protected:
public:
static _Engine *get_singleton() { return singleton; }
- void set_iterations_per_second(int p_ips);
- int get_iterations_per_second() const;
+ void set_physics_ticks_per_second(int p_ips);
+ int get_physics_ticks_per_second() const;
void set_physics_jitter_fix(double p_threshold);
double get_physics_jitter_fix() const;
diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml
index e4411ab1254..886a18900e1 100644
--- a/doc/classes/Engine.xml
+++ b/doc/classes/Engine.xml
@@ -149,20 +149,20 @@
See [url=https://docs.godotengine.org/en/latest/tutorials/plugins/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information.
[b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [kbd]F5[/kbd]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project.
-
- The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. This value should generally always be set to [code]60[/code] or above, as Godot doesn't interpolate the physics step. As a result, values lower than [code]60[/code] will look stuttery. This value can be increased to make input more reactive or work around tunneling issues, but keep in mind doing so will increase CPU usage.
-
Controls how much physics ticks are synchronized with real time. For 0 or less, the ticks are synchronized. Such values are recommended for network games, where clock synchronization matters. Higher values cause higher deviation of the in-game clock and real clock but smooth out framerate jitters. The default value of 0.5 should be fine for most; values above 2 could cause the game to react to dropped frames with a noticeable delay and are not recommended.
[b]Note:[/b] For best results, when using a custom physics interpolation solution, the physics jitter fix should be disabled by setting [member physics_jitter_fix] to [code]0[/code].
+
+ The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. This value should generally always be set to [code]60[/code] or above, as Godot doesn't interpolate the physics step. As a result, values lower than [code]60[/code] will look stuttery. This value can be increased to make input more reactive or work around tunneling issues, but keep in mind doing so will increase CPU usage. See also [member target_fps].
+
If [code]false[/code], stops printing error and warning messages to the console and editor Output log. This can be used to hide error and warning messages during unit test suite runs. This property is equivalent to the [member ProjectSettings.application/run/disable_stderr] project setting.
[b]Warning:[/b] If you set this to [code]false[/code] anywhere in the project, important error messages may be hidden even if they are emitted from other scripts. If this is set to [code]false[/code] in a [code]@tool[/code] script, this will also impact the editor itself. Do [i]not[/i] report bugs before ensuring error messages are enabled (as they are by default).
[b]Note:[/b] This property does not impact the editor's Errors tab when running a project from the editor.
- The desired frames per second. If the hardware cannot keep up, this setting may not be respected. A value of 0 means no limit.
+ The desired frames per second. If the hardware cannot keep up, this setting may not be respected. A value of 0 means no limit. See also [member physics_ticks_per_second].
Controls how fast or slow the in-game clock ticks versus the real life one. It defaults to 1.0. A value of 2.0 means the game moves twice as fast as real life, whilst a value of 0.5 means the game moves at half the regular speed.
diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml
index 3874046628a..096fbbf2c03 100644
--- a/doc/classes/Node.xml
+++ b/doc/classes/Node.xml
@@ -325,7 +325,7 @@
- Returns the time elapsed (in seconds) since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.iterations_per_second].
+ Returns the time elapsed (in seconds) since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.physics_ticks_per_second].
@@ -605,7 +605,7 @@
- Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a [constant NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine.iterations_per_second] to change) interval (and the [method _physics_process] callback will be called if exists). Enabled automatically if [method _physics_process] is overridden. Any calls to this before [method _ready] will be ignored.
+ Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a [constant NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine.physics_ticks_per_second] to change) interval (and the [method _physics_process] callback will be called if exists). Enabled automatically if [method _physics_process] is overridden. Any calls to this before [method _ready] will be ignored.
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index 6eba469e542..62c2b3295b3 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1344,7 +1344,7 @@
The default angular damp in 2D.
- [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration.
+ [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration.
The default gravity strength in 2D (in pixels per second squared).
@@ -1376,7 +1376,7 @@
The default linear damp in 2D.
- [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration.
+ [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration.
Sets which physics engine to use for 2D physics.
@@ -1396,7 +1396,7 @@
The default angular damp in 3D.
- [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration.
+ [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration.
The default gravity strength in 3D (in meters per second squared).
@@ -1428,7 +1428,7 @@
The default linear damp in 3D.
- [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration.
+ [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration.
Sets which physics engine to use for 3D physics.
@@ -1446,15 +1446,15 @@
Enables [member Viewport.physics_object_picking] on the root viewport.
-
- The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run.
- [b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.iterations_per_second] instead.
-
Controls how much physics ticks are synchronized with real time. For 0 or less, the ticks are synchronized. Such values are recommended for network games, where clock synchronization matters. Higher values cause higher deviation of in-game clock and real clock, but allows smoothing out framerate jitters. The default value of 0.5 should be fine for most; values above 2 could cause the game to react to dropped frames with a noticeable delay and are not recommended.
[b]Note:[/b] For best results, when using a custom physics interpolation solution, the physics jitter fix should be disabled by setting [member physics/common/physics_jitter_fix] to [code]0[/code].
[b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.physics_jitter_fix] instead.
+
+ The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run.
+ [b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.physics_ticks_per_second] instead.
+
diff --git a/main/main.cpp b/main/main.cpp
index d91cc5c9bf4..f899894642c 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1340,9 +1340,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
{
window_vsync_mode = DisplayServer::VSyncMode(int(GLOBAL_DEF("display/window/vsync/vsync_mode", DisplayServer::VSyncMode::VSYNC_ENABLED)));
}
- Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF_BASIC("physics/common/physics_fps", 60));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_fps",
- PropertyInfo(Variant::INT, "physics/common/physics_fps",
+ Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF_BASIC("physics/common/physics_ticks_per_second", 60));
+ 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_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5));
Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0));
@@ -2463,12 +2463,12 @@ bool Main::iteration() {
uint64_t ticks_elapsed = ticks - last_ticks;
- int physics_fps = Engine::get_singleton()->get_iterations_per_second();
- float physics_step = 1.0 / physics_fps;
+ int physics_ticks_per_second = Engine::get_singleton()->get_physics_ticks_per_second();
+ float physics_step = 1.0 / physics_ticks_per_second;
float time_scale = Engine::get_singleton()->get_time_scale();
- MainFrameTime advance = main_timer_sync.advance(physics_step, physics_fps);
+ MainFrameTime advance = main_timer_sync.advance(physics_step, physics_ticks_per_second);
double process_step = advance.process_step;
double scaled_step = process_step * time_scale;
diff --git a/main/main_timer_sync.cpp b/main/main_timer_sync.cpp
index 94e62bea97c..0d172be65e8 100644
--- a/main/main_timer_sync.cpp
+++ b/main/main_timer_sync.cpp
@@ -73,14 +73,14 @@ int MainTimerSync::get_average_physics_steps(double &p_min, double &p_max) {
}
// advance physics clock by p_process_step, return appropriate number of steps to simulate
-MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_fps, double p_process_step) {
+MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_ticks_per_second, double p_process_step) {
MainFrameTime ret;
ret.process_step = p_process_step;
// simple determination of number of physics iteration
time_accum += ret.process_step;
- ret.physics_steps = floor(time_accum * p_physics_fps);
+ ret.physics_steps = floor(time_accum * p_physics_ticks_per_second);
int min_typical_steps = typical_physics_steps[0];
int max_typical_steps = min_typical_steps + 1;
@@ -107,7 +107,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
// try to keep it consistent with previous iterations
if (ret.physics_steps < min_typical_steps) {
- const int max_possible_steps = floor((time_accum)*p_physics_fps + get_physics_jitter_fix());
+ const int max_possible_steps = floor((time_accum)*p_physics_ticks_per_second + get_physics_jitter_fix());
if (max_possible_steps < min_typical_steps) {
ret.physics_steps = max_possible_steps;
update_typical = true;
@@ -115,7 +115,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
ret.physics_steps = min_typical_steps;
}
} else if (ret.physics_steps > max_typical_steps) {
- const int min_possible_steps = floor((time_accum)*p_physics_fps - get_physics_jitter_fix());
+ const int min_possible_steps = floor((time_accum)*p_physics_ticks_per_second - get_physics_jitter_fix());
if (min_possible_steps > max_typical_steps) {
ret.physics_steps = min_possible_steps;
update_typical = true;
@@ -146,7 +146,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
}
// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
-MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physics_fps, double p_process_step) {
+MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physics_ticks_per_second, double p_process_step) {
if (fixed_fps != -1) {
p_process_step = 1.0 / fixed_fps;
}
@@ -154,7 +154,7 @@ MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physic
// compensate for last deficit
p_process_step += time_deficit;
- MainFrameTime ret = advance_core(p_physics_step, p_physics_fps, p_process_step);
+ MainFrameTime ret = advance_core(p_physics_step, p_physics_ticks_per_second, p_process_step);
// we will do some clamping on ret.process_step and need to sync those changes to time_accum,
// that's easiest if we just remember their fixed difference now
@@ -220,8 +220,8 @@ void MainTimerSync::set_fixed_fps(int p_fixed_fps) {
}
// advance one physics frame, return timesteps to take
-MainFrameTime MainTimerSync::advance(double p_physics_step, int p_physics_fps) {
+MainFrameTime MainTimerSync::advance(double p_physics_step, int p_physics_ticks_per_second) {
double cpu_process_step = get_cpu_process_step();
- return advance_checked(p_physics_step, p_physics_fps, cpu_process_step);
+ return advance_checked(p_physics_step, p_physics_ticks_per_second, cpu_process_step);
}
diff --git a/main/main_timer_sync.h b/main/main_timer_sync.h
index abdec18f6df..d0ebcb8f967 100644
--- a/main/main_timer_sync.h
+++ b/main/main_timer_sync.h
@@ -77,10 +77,10 @@ protected:
int get_average_physics_steps(double &p_min, double &p_max);
// advance physics clock by p_process_step, return appropriate number of steps to simulate
- MainFrameTime advance_core(double p_physics_step, int p_physics_fps, double p_process_step);
+ MainFrameTime advance_core(double p_physics_step, int p_physics_ticks_per_second, double p_process_step);
// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
- MainFrameTime advance_checked(double p_physics_step, int p_physics_fps, double p_process_step);
+ MainFrameTime advance_checked(double p_physics_step, int p_physics_ticks_per_second, double p_process_step);
// determine wall clock step since last iteration
double get_cpu_process_step();
@@ -96,7 +96,7 @@ public:
void set_fixed_fps(int p_fixed_fps);
// advance one frame, return timesteps to take
- MainFrameTime advance(double p_physics_step, int p_physics_fps);
+ MainFrameTime advance(double p_physics_step, int p_physics_ticks_per_second);
};
#endif // MAIN_TIMER_SYNC_H
diff --git a/scene/3d/velocity_tracker_3d.cpp b/scene/3d/velocity_tracker_3d.cpp
index a027749eaae..8f4fecb3486 100644
--- a/scene/3d/velocity_tracker_3d.cpp
+++ b/scene/3d/velocity_tracker_3d.cpp
@@ -70,7 +70,7 @@ Vector3 VelocityTracker3D::get_tracked_linear_velocity() const {
if (position_history_len) {
if (physics_step) {
uint64_t base = Engine::get_singleton()->get_physics_frames();
- base_time = double(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second();
+ base_time = double(base - position_history[0].frame) / Engine::get_singleton()->get_physics_ticks_per_second();
} else {
uint64_t base = Engine::get_singleton()->get_frame_ticks();
base_time = double(base - position_history[0].frame) / 1000000.0;
@@ -83,7 +83,7 @@ Vector3 VelocityTracker3D::get_tracked_linear_velocity() const {
Vector3 distance = position_history[i].position - position_history[i + 1].position;
if (physics_step) {
- delta = double(diff) / Engine::get_singleton()->get_iterations_per_second();
+ delta = double(diff) / Engine::get_singleton()->get_physics_ticks_per_second();
} else {
delta = double(diff) / 1000000.0;
}