Skip to content

The GlobalTransform did not get updated when Parent was removed #7263

@vby

Description

@vby

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

The GlobalTransform did not get updated (it should be) when Parent was removed.

What solution would you like?

  • Always recalculate the new GlobalTransform then set_if_neq.
if transform_changed {
    *global_transform = GlobalTransform::from(*transform);
} else {
    global_transform.set_if_neq(GlobalTransform::from(*transform));
}
  • Or use RemovedComponents<Parent>, which may have poor performance if there have so many entities without Transform.

  • Or use Removed change detection, but does not exist currently.

Query<(&Transform, &mut GlobalTransform, Removed<Parent>)>
if parent_removed || transform_changed {
  *global_transform = GlobalTransform::from(*transform);
}

What alternative(s) have you considered?

none

Additional context

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-TransformTranslations, rotations and scalesC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions