mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Physics Interpolation - Reset on adding child to SceneTree
For convenience, branches added to the SceneTree now have physics interpolation reset after the first update of the transform to the VisualServer.
This commit is contained in:
@@ -101,6 +101,15 @@ void VisualInstance::_notification(int p_what) {
|
||||
if (!_is_using_identity_transform()) {
|
||||
Transform gt = get_global_transform();
|
||||
VisualServer::get_singleton()->instance_set_transform(instance, gt);
|
||||
|
||||
// For instance when first adding to the tree, when the previous transform is
|
||||
// unset, to prevent streaking from the origin.
|
||||
if (_is_physics_interpolation_reset_requested()) {
|
||||
if (_is_vi_visible()) {
|
||||
_notification(NOTIFICATION_RESET_PHYSICS_INTERPOLATION);
|
||||
}
|
||||
_set_physics_interpolation_reset_requested(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
Reference in New Issue
Block a user