pub mod components; pub mod hierarchy; pub mod transform_propagate_system; pub mod prelude { pub use crate::{components::*, hierarchy::*, TransformPlugin}; } use bevy_app::prelude::*; use bevy_ecs::prelude::*; use bevy_type_registry::RegisterType; use prelude::{Children, GlobalTransform, Parent, Transform}; pub(crate) fn transform_systems() -> Vec> { let mut systems = Vec::with_capacity(5); systems.append(&mut hierarchy::hierarchy_maintenance_systems()); systems.push(transform_propagate_system::transform_propagate_system.system()); systems } #[derive(Default)] pub struct TransformPlugin; impl Plugin for TransformPlugin { fn build(&self, app: &mut AppBuilder) { app.register_component_with::(|reg| reg.map_entities()) .register_component_with::(|reg| reg.map_entities()) .register_component::() .register_component::() // add transform systems to startup so the first update is "correct" .add_startup_systems(transform_systems()) .add_systems_to_stage(stage::POST_UPDATE, transform_systems()); } }