bevy/crates/bevy_transform/src/lib.rs

32 lines
1.1 KiB
Rust
Raw Normal View History

pub mod components;
pub mod hierarchy;
pub mod transform_propagate_system;
pub mod prelude {
2020-07-16 23:32:39 +00:00
pub use crate::{components::*, hierarchy::*, TransformPlugin};
2020-07-10 04:18:35 +00:00
}
2020-07-17 01:47:51 +00:00
use bevy_app::prelude::*;
2020-07-16 23:32:39 +00:00
use bevy_type_registry::RegisterType;
use prelude::{parent_update_system, Children, GlobalTransform, Parent, Transform};
2020-07-16 23:32:39 +00:00
#[derive(Default)]
pub struct TransformPlugin;
2020-08-08 03:22:17 +00:00
impl Plugin for TransformPlugin {
2020-07-16 23:32:39 +00:00
fn build(&self, app: &mut AppBuilder) {
app.register_component_with::<Children>(|reg| reg.map_entities())
.register_component_with::<Parent>(|reg| reg.map_entities())
2020-07-16 23:32:39 +00:00
.register_component::<Transform>()
.register_component::<GlobalTransform>()
2020-07-16 23:32:39 +00:00
// add transform systems to startup so the first update is "correct"
.add_startup_system(parent_update_system)
.add_startup_system(transform_propagate_system::transform_propagate_system)
.add_system_to_stage(stage::POST_UPDATE, parent_update_system)
.add_system_to_stage(
stage::POST_UPDATE,
transform_propagate_system::transform_propagate_system,
);
2020-07-16 23:32:39 +00:00
}
}