summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/bind/core_bind.cpp11
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/engine.cpp11
-rw-r--r--core/engine.h4
4 files changed, 29 insertions, 0 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index ffddab410b..9c484f313e 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2652,6 +2652,14 @@ int _Engine::get_iterations_per_second() const {
return Engine::get_singleton()->get_iterations_per_second();
}
+void _Engine::set_physics_jitter_fix(float p_threshold) {
+ Engine::get_singleton()->set_physics_jitter_fix(p_threshold);
+}
+
+float _Engine::get_physics_jitter_fix() const {
+ return Engine::get_singleton()->get_physics_jitter_fix();
+}
+
void _Engine::set_target_fps(int p_fps) {
Engine::get_singleton()->set_target_fps(p_fps);
}
@@ -2718,6 +2726,8 @@ 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_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("set_target_fps", "target_fps"), &_Engine::set_target_fps);
ClassDB::bind_method(D_METHOD("get_target_fps"), &_Engine::get_target_fps);
@@ -2743,6 +2753,7 @@ void _Engine::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second");
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_scale"), "set_time_scale", "get_time_scale");
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix");
}
_Engine *_Engine::singleton = NULL;
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index fe074e2122..625cac25a0 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -670,6 +670,9 @@ public:
void set_iterations_per_second(int p_ips);
int get_iterations_per_second() const;
+ void set_physics_jitter_fix(float p_threshold);
+ float get_physics_jitter_fix() const;
+
void set_target_fps(int p_fps);
int get_target_fps() const;
diff --git a/core/engine.cpp b/core/engine.cpp
index af9052110f..b2c34a853c 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -42,6 +42,16 @@ int Engine::get_iterations_per_second() const {
return ips;
}
+void Engine::set_physics_jitter_fix(float p_threshold) {
+ if (p_threshold < 0)
+ p_threshold = 0;
+ physics_jitter_fix = p_threshold;
+}
+
+float Engine::get_physics_jitter_fix() const {
+ return physics_jitter_fix;
+}
+
void Engine::set_target_fps(int p_fps) {
_target_fps = p_fps > 0 ? p_fps : 0;
}
@@ -137,6 +147,7 @@ Engine::Engine() {
singleton = this;
frames_drawn = 0;
ips = 60;
+ physics_jitter_fix = 0.5;
_frame_delay = 0;
_fps = 1;
_target_fps = 0;
diff --git a/core/engine.h b/core/engine.h
index 54b30ab81f..665992699a 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -57,6 +57,7 @@ private:
float _frame_step;
int ips;
+ float physics_jitter_fix;
float _fps;
int _target_fps;
float _time_scale;
@@ -79,6 +80,9 @@ public:
virtual void set_iterations_per_second(int p_ips);
virtual int get_iterations_per_second() const;
+ void set_physics_jitter_fix(float p_threshold);
+ float get_physics_jitter_fix() const;
+
virtual void set_target_fps(int p_fps);
virtual float get_target_fps() const;