-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Physics Interpolation - Auto-reset on set_physics_interpolation_mode()
#102652
Physics Interpolation - Auto-reset on set_physics_interpolation_mode()
#102652
Conversation
Fixes historical bug where auto-reset wasn't working correctly. Also fixes process modes on Cameras when mode is changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me.
This does not completely fix the bug. Any nodes that start hidden will still trigger the issue (which is a potential epilepsy risk, I might add).
They should always be reset, because the existing data is uninitialized. And by uninitialized I mean they vibrate constantly forever between the world origin and their starting position. We're going from no interpolation to having interpolation, so it doesn't make sense that they should have interpolation anyway. It's better for an interpolated object to be "unprimed" than to shake violently. |
Yes, that's what the PR says, and what I pointed out here: #101192 (comment) . If a node is hidden, then at the risk of pointing out the obvious, then you won't see it vibrating or anything else, because it is, well, hidden. If a node is hidden, then it's children are also hidden. As I explained when you first asked about this in rocketchat, in Godot the general paradigm is we don't do a load of processing on hidden nodes. If 99% of the nodes in a scene are hidden, we try to reduce as much processing as possible on them so the game runs faster. Instead what we do is when unhiding them we make sure things are up to date so they will appear in the right place. This often has to be propagated, because unhiding a node may also unhide all its children. If one child is hidden that has 1000 children, that's a lot of propagation that would have to take place unnecessarily for moving hidden nodes. This is something that reduz decided early on in Godot, and it is common in game engines. Physics interpolation does pose some challenges here, because we rely on a stream of previous and current transforms. In most cases this means we will eventually end up doing a reset (and propagating) when unhiding nodes, but there are some subtleties to take care of, particularly trying to best deal with unhiding nodes with a moving start. In rocketchat (as I understood it) you were suggesting your idea that we should instead update hidden nodes so that their previous and current transforms would be correct when they were (eventually) unhidden. That would indeed solve the problem yes, you are correct, but it would have the unfortunate side-effect of making some games run at 10fps instead of 60fps, and I'm not sure users would be happy with that trade off.
Just to refresh, this is what I posted on Jan 7th when you were asking about this problem:
|
Thanks! |
Thank you for the response. Just to clarify though, my PR isn't updating hidden nodes every frame. It only does this when switching the SceneTree's physics interpolation mode. I ended up going with a different system than what we had discussed in RocketChat. I suspect this is where communication broke down. Basically, the only performance impact from my PR would be when the SceneTree's physics interpolation mode is switched (which won't be often). In effect it is doing the same thing as your PR, but also affecting invisible nodes.
Not while it's hidden, no. But when it's unhidden it'll start vibrating.
When you mention unhiding, do you mean that this will be handled for the user? Or will the user still have to do manual physics resets? If it's the former, I could see this as being a more elegant solution. I'm assuming this would work based off some sort of timestamp? |
We were aware of how your PR worked, but preferred to go with the existing Godot paradigm that I've attempted to describe above (don't update hidden, update on showing). I did try to communicate this, but apologies if this was misunderstood, I may have assumed some knowledge of Godot core and the client / server architecture.
Yes. |
Thanks for the clarification! |
Fixes historical bug where auto-reset wasn't working correctly. Also fixes process modes on Cameras when mode is changed.
Forward port of #101218 (see that PR for more details)
Helps address #101192
Doesn't address hidden nodes - these will likely be addressed generally as part of unhiding as the problem of whether or not to reset on unhiding is common to several situations.