[3.x] Physics Interpolation - reduce xforms in non-interpolated nodes#103331
Closed
lawnjelly wants to merge 1 commit intogodotengine:3.xfrom
Closed
[3.x] Physics Interpolation - reduce xforms in non-interpolated nodes#103331lawnjelly wants to merge 1 commit intogodotengine:3.xfrom
lawnjelly wants to merge 1 commit intogodotengine:3.xfrom
Conversation
In the specific case of non-interpolated nodes, if ancestor nodes were moved on the physics tick this would lead to unnecessary NOTIFICATION_TRANSFORM_CHANGED and calls to `VisualServer`. This would lower performance and lead to unwanted physics interpolation warnings about movement on physics ticks. Here we remove these unnecessary notifications.
f347721 to
de9265c
Compare
Member
Author
|
Closing this as it's not relevant if we go for #103685 . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the specific case of non-interpolated nodes, if ancestor nodes were moved on the physics tick this would lead to unnecessary NOTIFICATION_TRANSFORM_CHANGED and calls to
VisualServer.This would lower performance and lead to unwanted physics interpolation warnings about movement on physics ticks.
Here we remove these unnecessary notifications.
Fixes #103330
Relevant to #103232
Relevant to #103025
Relevant to #101823
Notes
top_levelis applied to the first non-interpolated node.But users can also choose to operate non-interpolated branches without
top_level, so we want to make sure this works efficiently and correctly.top_level). This prevents physics movements on ancestors affecting the non-interpolated branch, but still allows the possibility of setting non-interpolated branch xforms directly on physics ticks.UPDATE:
Camera3Dseems to work fine, it doesn't depend onNOTIFICATION_TRANSFORM_CHANGED. And teleportation should work, because non-interpolated nodes need to update their xform each frame anyway.Discussion
An alternative way to prevent propagation of
TRANSFORM_CHANGEDinto non-interpolated branches is to set the first non-interpolated node totop_level.top_levelchildren already don't have transforms propagated to them.This is indeed the approach I took in the primary use case for non-interpolated branches - manually interpolated
Cameras. This is probably the reason why I hadn't seen these warnings and the potential for this problem before.It probably makes sense to close this bug via this PR whether or not we go with using
top_levelor not for non-interpolated branches. 🤔To elaborate, the first non-interpolated (3D) child of a moving interpolated node will always require some special treatment to work correctly. The reason is that if nothing else is changed, this child will judder on each physics tick because its render xform will be based on the physics transform of the parent.
Thus the child will usually either need to:
get_global_transform_interpolated()on some target node (maybe the parent)get_global_transform_interpolated(), but without the need for primingIn the longterm, t is not out of the question to possibly automatically set the first non-interpolated node as top level. But that would be for later PR / discussion.
Related
It is also just possible we could have a system whereby the first non-interpolated child automatically grabbed the client interpolated xform from the parent on each frame. But that's perhaps something to consider once we handle all the cases, IK, ragdoll and XR and see if there is a common code that can be consolidated.