diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index f85cb3fec907c1..71355f26932850 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -28,6 +28,9 @@ use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; /// update the [`Transform`] of an entity in this stage or after, you will notice a 1 frame lag /// before the [`GlobalTransform`] is updated. /// +/// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set) +/// to control when transforms are propagated from parents to children. +/// /// # Examples /// /// - [`transform`] diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 0c09757573aeb5..1fa1ea1c54970b 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -79,6 +79,13 @@ pub enum TransformSystem { TransformPropagate, } +/// Transform propagation system set for third party plugins use +pub fn transform_propagate_system_set() -> SystemSet { + SystemSet::new() + .with_system(systems::sync_simple_transforms) + .with_system(systems::propagate_transforms) +} + /// The base plugin for handling [`Transform`] components #[derive(Default)] pub struct TransformPlugin; diff --git a/crates/bevy_transform/src/systems.rs b/crates/bevy_transform/src/systems.rs index fb237d42c22f0b..c31146c1f3ebc3 100644 --- a/crates/bevy_transform/src/systems.rs +++ b/crates/bevy_transform/src/systems.rs @@ -3,6 +3,9 @@ use bevy_ecs::prelude::{Changed, Entity, Query, With, Without}; use bevy_hierarchy::{Children, Parent}; /// Update [`GlobalTransform`] component of entities that aren't in the hierarchy +/// +/// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set) +/// to propagate transforms correctly. pub fn sync_simple_transforms( mut query: Query< (&Transform, &mut GlobalTransform), @@ -16,6 +19,9 @@ pub fn sync_simple_transforms( /// Update [`GlobalTransform`] component of entities based on entity hierarchy and /// [`Transform`] component. +/// +/// Third party plugins should use [`transform_propagate_system_set`](crate::transform_propagate_system_set) +/// to propagate transforms correctly. pub fn propagate_transforms( mut root_query: Query< (