Godot: Camera2d has a one frame delay

Created on 28 Apr 2019  路  8Comments  路  Source: godotengine/godot

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.

bug confirmed core rendering

Most helpful comment

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.

All 8 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.

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.

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.

ezgif com-video-to-gif (2)

@MightyPrinny omg thank you so much force_update_scroll() worked well for me!

Still reproduceable in Godot 3.2.3.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spooner picture Spooner  路  3Comments

RebelliousX picture RebelliousX  路  3Comments

bojidar-bg picture bojidar-bg  路  3Comments

EdwardAngeles picture EdwardAngeles  路  3Comments

timoschwarzer picture timoschwarzer  路  3Comments