use crate::app::{App, Plugin};
use gizmo_physics_rigid::world::PhysicsWorld;
use crate::math::Vec3;
pub struct PhysicsPlugin {
pub gravity: Vec3,
}
impl Default for PhysicsPlugin {
fn default() -> Self {
Self {
gravity: Vec3::new(0.0, -9.81, 0.0),
}
}
}
impl<State: 'static> Plugin<State> for PhysicsPlugin {
fn build(&self, app: &mut App<State>) {
tracing::info!(
"[Plugin] PhysicsPlugin yükleniyor (Yerçekimi: {:?})...",
self.gravity
);
app.world
.insert_resource(PhysicsWorld::new().with_gravity(self.gravity));
}
}
pub struct TransformPlugin;
impl<State: 'static> Plugin<State> for TransformPlugin {
fn build(&self, app: &mut App<State>) {
app.schedule.add_di_system(
gizmo_core::system::SystemConfig::new(Box::new(
crate::systems::transform::TransformSyncSystem,
))
.label("transform_sync"),
);
app.schedule.add_di_system(
gizmo_core::system::SystemConfig::new(Box::new(
crate::systems::transform::TransformPropagateSystem,
))
.label("transform_propagate")
.after("transform_sync"),
);
}
}