1- use bevy:: { core:: FrameCount , ecs :: schedule :: ScheduleLabel , prelude :: * } ;
1+ use bevy:: { core:: FrameCount , prelude :: * , transform :: TransformSystem } ;
22use bevy_rapier2d:: prelude:: * ;
33
4- #[ derive( ScheduleLabel , Hash , Debug , PartialEq , Eq , Clone ) ]
5- struct SpecialSchedule ;
6-
74fn main ( ) {
85 let mut app = App :: new ( ) ;
96
@@ -12,58 +9,40 @@ fn main() {
129 0xF9 as f32 / 255.0 ,
1310 0xFF as f32 / 255.0 ,
1411 ) ) )
15- . add_plugins ( DefaultPlugins )
16- . add_plugin ( RapierDebugRenderPlugin :: default ( ) )
17- . add_startup_system ( setup_graphics)
18- . add_startup_system ( setup_physics)
19- . add_system (
20- ( |world : & mut World | {
21- world. run_schedule ( SpecialSchedule ) ;
22- } )
23- . in_base_set ( CoreSet :: PostUpdate ) ,
24- ) ;
25-
26- // Do the setup however we want, maybe in its very own schedule
27- let mut schedule = Schedule :: new ( ) ;
28-
29- schedule. configure_sets (
12+ . add_plugins ( (
13+ DefaultPlugins ,
14+ RapierPhysicsPlugin :: < NoUserData > :: pixels_per_meter ( 100.0 ) . with_default_system_setup ( false ) ,
15+ RapierDebugRenderPlugin :: default ( ) ,
16+ ) )
17+ . add_systems ( Startup , ( setup_graphics, setup_physics) ) ;
18+
19+ app. configure_sets (
20+ PostUpdate ,
3021 (
3122 PhysicsSet :: SyncBackend ,
32- PhysicsSet :: SyncBackendFlush ,
3323 PhysicsSet :: StepSimulation ,
3424 PhysicsSet :: Writeback ,
3525 )
36- . chain ( ) ,
37- ) ;
38-
39- schedule. add_systems (
40- RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: SyncBackend )
41- . in_base_set ( PhysicsSet :: SyncBackend ) ,
26+ . chain ( )
27+ . before ( TransformSystem :: TransformPropagate ) ,
4228 ) ;
4329
44- schedule. add_systems (
45- RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: SyncBackendFlush )
46- . in_base_set ( PhysicsSet :: SyncBackendFlush ) ,
47- ) ;
48-
49- schedule. add_systems (
50- RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: StepSimulation )
51- . in_base_set ( PhysicsSet :: StepSimulation ) ,
52- ) ;
53- schedule. add_system ( despawn_one_box. in_base_set ( PhysicsSet :: StepSimulation ) ) ;
54-
55- schedule. add_systems (
56- RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: Writeback )
57- . in_base_set ( PhysicsSet :: Writeback ) ,
30+ app. add_systems (
31+ PostUpdate ,
32+ (
33+ RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: SyncBackend )
34+ . in_set ( PhysicsSet :: SyncBackend ) ,
35+ (
36+ RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: StepSimulation ) ,
37+ despawn_one_box,
38+ )
39+ . in_set ( PhysicsSet :: StepSimulation ) ,
40+ RapierPhysicsPlugin :: < NoUserData > :: get_systems ( PhysicsSet :: Writeback )
41+ . in_set ( PhysicsSet :: Writeback ) ,
42+ ) ,
5843 ) ;
5944
60- app. add_schedule ( SpecialSchedule , schedule)
61- . add_plugin (
62- RapierPhysicsPlugin :: < NoUserData > :: default ( )
63- . with_physics_scale ( 100. )
64- . with_default_system_setup ( false ) ,
65- )
66- . run ( ) ;
45+ app. run ( ) ;
6746}
6847
6948fn despawn_one_box (
0 commit comments