Closed jcornaz closed 2 years ago
I observed a similar lag when I tried to sync a camera to a body.
My guess: heron's step systems are responsible for updating bevy's Transform
(see here). They are running in CoreStage::PostUpdate
(see here). bevy's GlobalTransform
are being updated in the same stage. Its doc says:
This system runs in stage CoreStage::PostUpdate. If you update theTransform of an entity in this stage or after, you will notice a 1 frame lag before the GlobalTransform is updated.
I was able to fix my problem with
.add_system_to_stage(
CoreStage::PostUpdate,
set_camera_to_player
// The player's `Transform` is updated here
.after(PhysicsSystem::TransformUpdate)
// The camera's `Transform` is used here
.before(TransformSystem::TransformPropagate),
)
Yes, this is the problem (and solution).
I just didn't have time to solve it yet as I was on holiday. Hopefully (but unsure), I may have time this weekend.
If you want to fix it yourself and open a pull request, you can. Just don't forget to add a test ;-)
~Actually, after a deeper look, I cannot manage to create a test that reproduces the problem.~
~@Occuros, could you share how to reproduce?~
EDIT: I managed to reproduce, and fix it. I should be able to publish the fix today
As reported in the discussion #230: