mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 21:31:10 +01:00
Physics Interpolation - Flush transforms after physics tick
Leftover transforms from the physics tick were being flushed during idle, which was causing problems for physics interpolation. This PR flushes the transforms at the end of the physics tick when physics interpolation is active.
This commit is contained in:
parent
77a399398d
commit
da628411d2
@ -67,6 +67,7 @@ public:
|
|||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual bool iteration(float p_time);
|
virtual bool iteration(float p_time);
|
||||||
|
virtual void iteration_end() {}
|
||||||
virtual bool idle(float p_time);
|
virtual bool idle(float p_time);
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
|
@ -2215,6 +2215,8 @@ bool Main::iteration() {
|
|||||||
|
|
||||||
message_queue->flush();
|
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_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);
|
physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max);
|
||||||
Engine::get_singleton()->_physics_frames++;
|
Engine::get_singleton()->_physics_frames++;
|
||||||
|
@ -535,6 +535,14 @@ void SceneTree::client_physics_interpolation_remove_spatial(SelfList<Spatial> *p
|
|||||||
_client_physics_interpolation._spatials_list.remove(p_elem);
|
_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) {
|
bool SceneTree::iteration(float p_time) {
|
||||||
root_lock++;
|
root_lock++;
|
||||||
|
|
||||||
|
@ -305,6 +305,7 @@ public:
|
|||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
virtual bool iteration(float p_time);
|
virtual bool iteration(float p_time);
|
||||||
|
virtual void iteration_end();
|
||||||
virtual bool idle(float p_time);
|
virtual bool idle(float p_time);
|
||||||
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
Loading…
Reference in New Issue
Block a user