diff --git a/bevy_rapier3d/examples/change_contexts3.rs b/bevy_rapier3d/examples/change_contexts3.rs new file mode 100644 index 000000000..e72303c7b --- /dev/null +++ b/bevy_rapier3d/examples/change_contexts3.rs @@ -0,0 +1,126 @@ +use bevy::prelude::*; +use bevy_rapier3d::prelude::*; + +const N_CONTEXTS: usize = 5; +const WORLD_CHANGE_DELAY_SEC: f32 = 3.0; + +#[derive(Component)] +/// Denotes which object(s) to change the world of +struct ChangeWorld; + +#[derive(Resource, Debug)] +struct Contexts(Vec); + +fn main() { + App::new() + .insert_resource(ClearColor(Color::linear_rgb( + 0xF9 as f32 / 255.0, + 0xF9 as f32 / 255.0, + 0xFF as f32 / 255.0, + ))) + .add_plugins(( + DefaultPlugins, + RapierPhysicsPlugin::::default(), + RapierDebugRenderPlugin::default(), + )) + .add_systems(Startup, (setup_graphics, setup_physics)) + .add_systems(Update, change_world) + .run(); +} + +fn change_world( + mut query: Query<&mut RapierContextEntityLink, With>, + time: Res