-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Camera2d has a one frame delay #28492
Comments
I notice this on my WIP PR for 2.5D demos. However, it's not the worst thing in the world, it kind of shows the velocity based on how close the character is to the edge of the screen. |
IIRC you can use force_update_scroll to make it update immediately. |
Indeed, that is a functioning workaround, but imo it shouldn't be necessary. If the camera is parented to something, and all the special margin/smoothing options are turned off, the natural expectation is that the effective position updates like any other transform, I think. |
@MightyPrinny Thanks for sharing the work around. Also ran into this, don't know when this started exactly, but hadn't had this issue in older work. Even children attached to Camera2D will jitter about when the camera moves. |
Camera2D should be updated in NOTIFICATION_TRANSFORM_CHANGED if there is no smoothing, so that's strange. |
@bojidar-bg Strange indeed, here is what I'm seeing at least. When starting and stopping, the attached node and the draw position lurches back and forth. |
@MightyPrinny omg thank you so much |
Still reproduceable in Godot 3.2.3. |
It turns out this problem is very apparent with transform snapping, see #43554. I put full explanation there but it is caused by:
It is failing this check, not updating the scroll immediately, and only doing so in the next INTERNAL_PROCESS or INTERNAL_PHYSICS_PROCESS. |
We tested how many times does the We tested your idea, simply removing the "if statement" fixed it. We think that |
I did briefly talk about this with reduz. Although there does seem to be something problematic here, it is highly likely that the Order of operations problems are often like this unfortunately, and it would probably require a fair bit of research and understanding to know whether this was a sensible fix. For now, certainly, @MightyPrinny 's workaround works. |
True, we thought the same thing.
True, we are going to use this solution, and check if it will create any problem in our end. In the other side, But we will leave it for devs to confirm our hypothesis. -TechnoArt Studio |
Fixed by #46697. |
Godot version:
3.1.1.stable.official
OS/device including version:
Windows 10
Issue description:
Camera2D with no margin or smoothing, attached to a Sprite with a simple movement script, follows the Sprite, but with a one frame delay on its position. This is most visible during the very start of the motion, and the very end.
Expected behaviour:
Camera2D follows the sprite exactly.
Other notes:
This looks like it's a result of internal node functionality happening on NOTIFICATION_INTERNAL_PROCESS before gamecode-driven position updates happen on NOTIFICATION_PROCESS.
Minimal reproduction project:
Random.zip
Launch, and use arrow keys to move. Watch at the start and end of movement to see the issue.
The text was updated successfully, but these errors were encountered: