1use crate::app::{App, Plugin};
2use gizmo_physics_rigid::world::PhysicsWorld;
3
4use crate::math::Vec3;
5
6pub struct PhysicsPlugin {
9 pub gravity: Vec3,
10}
11
12impl Default for PhysicsPlugin {
13 fn default() -> Self {
14 Self {
15 gravity: Vec3::new(0.0, -9.81, 0.0),
16 }
17 }
18}
19
20impl<State: 'static> Plugin<State> for PhysicsPlugin {
21 fn build(&self, app: &mut App<State>) {
22 tracing::info!(
23 "[Plugin] PhysicsPlugin yükleniyor (Yerçekimi: {:?})...",
24 self.gravity
25 );
26 app.world
27 .insert_resource(PhysicsWorld::new().with_gravity(self.gravity));
28 }
30}
31
32pub struct TransformPlugin;
34
35impl<State: 'static> Plugin<State> for TransformPlugin {
36 fn build(&self, app: &mut App<State>) {
37 app.schedule.add_di_system(
39 gizmo_core::system::SystemConfig::new(Box::new(
40 crate::systems::transform::TransformSyncSystem,
41 ))
42 .label("transform_sync"),
43 );
44 app.schedule.add_di_system(
45 gizmo_core::system::SystemConfig::new(Box::new(
46 crate::systems::transform::TransformPropagateSystem,
47 ))
48 .label("transform_propagate")
49 .after("transform_sync"),
50 );
51 }
52}