Skip to content

Update GlobalTransform as part of FixedUpdate #7836

Open
@jabuwu

Description

@jabuwu

What problem does this solve or what need does it fill?

The purpose of FixedUpdate and fixed timesteps in general is to improve determinism in systems, but any fixed update system relying on GlobalTransform will currently suffer from a lack of determinism if it runs multiple times in 1 frame.

What solution would you like?

GlobalTransform should be updated between fixed updates.

What alternative(s) have you considered?

Games could add these systems to FixedUpdate themselves. It's actually fairly easy to do already.

use bevy::{
    prelude::*,
    transform::systems::{propagate_transforms, sync_simple_transforms},
};

#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
pub enum FixedTransformSystem {
    TransformPropagate,
}

// ...

app.add_system_to_schedule(
    CoreSchedule::FixedUpdate,
    sync_simple_transforms.in_set(FixedTransformSystem::TransformPropagate),
)
.add_system_to_schedule(
    CoreSchedule::FixedUpdate,
    propagate_transforms.in_set(FixedTransformSystem::TransformPropagate),
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TimeInvolves time keeping and reportingA-TransformTranslations, rotations and scalesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-BlockedThis cannot move forward until something else changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions