Merge pull request #60763 from lawnjelly/fti_physics_flush

This commit is contained in:
Rémi Verschelde 2022-05-05 11:59:15 +02:00 committed by GitHub
commit 13bb7c6c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 0 deletions

View File

@ -68,6 +68,7 @@ public:
virtual void init();
virtual bool iteration(float p_time);
virtual void iteration_end() {}
virtual bool idle(float p_time);
virtual void finish();

View File

@ -2257,6 +2257,8 @@ bool Main::iteration() {
message_queue->flush();
OS::get_singleton()->get_main_loop()->iteration_end();
physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - physics_begin); // keep the largest one for reference
physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max);
Engine::get_singleton()->_physics_frames++;

View File

@ -525,6 +525,14 @@ void SceneTree::client_physics_interpolation_remove_spatial(SelfList<Spatial> *p
_client_physics_interpolation._spatials_list.remove(p_elem);
}
void SceneTree::iteration_end() {
// When physics interpolation is active, we want all pending transforms
// to be flushed to the VisualServer before finishing a physics tick.
if (_physics_interpolation_enabled) {
flush_transform_notifications();
}
}
bool SceneTree::iteration(float p_time) {
root_lock++;

View File

@ -306,6 +306,7 @@ public:
virtual void init();
virtual bool iteration(float p_time);
virtual void iteration_end();
virtual bool idle(float p_time);
virtual void finish();