1
- use bevy:: { core:: FrameCount , ecs :: schedule :: ScheduleLabel , prelude :: * } ;
1
+ use bevy:: { core:: FrameCount , prelude :: * , transform :: TransformSystem } ;
2
2
use bevy_rapier2d:: prelude:: * ;
3
3
4
- #[ derive( ScheduleLabel , Hash , Debug , PartialEq , Eq , Clone ) ]
5
- struct SpecialSchedule ;
6
-
7
4
fn main ( ) {
8
5
let mut app = App :: new ( ) ;
9
6
@@ -12,58 +9,40 @@ fn main() {
12
9
0xF9 as f32 / 255.0 ,
13
10
0xFF as f32 / 255.0 ,
14
11
) ) )
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 ,
30
21
(
31
22
PhysicsSet :: SyncBackend ,
32
- PhysicsSet :: SyncBackendFlush ,
33
23
PhysicsSet :: StepSimulation ,
34
24
PhysicsSet :: Writeback ,
35
25
)
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 ) ,
42
28
) ;
43
29
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
+ ) ,
58
43
) ;
59
44
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 ( ) ;
67
46
}
68
47
69
48
fn despawn_one_box (
0 commit comments