From 2ca165bf9f3df545ea00ed7b88138042aceb52e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Lescaudey=20de=20Maneville?= Date: Tue, 20 Feb 2024 09:35:05 +0100 Subject: [PATCH] examples --- examples/anchors_example.rs | 10 +++------- examples/balloon_example.rs | 11 ++--------- examples/camera_plugin.rs | 2 +- examples/flag_example.rs | 2 +- examples/moving_example.rs | 4 ++-- examples/rapier_collision_example.rs | 2 +- examples/xpbd_collision_example.rs | 2 +- 7 files changed, 11 insertions(+), 22 deletions(-) diff --git a/examples/anchors_example.rs b/examples/anchors_example.rs index 72d5416..e19a60e 100644 --- a/examples/anchors_example.rs +++ b/examples/anchors_example.rs @@ -28,7 +28,7 @@ fn setup( transform: Transform::from_rotation(Quat::from_rotation_y(5.0)), ..Default::default() }); - let mesh_handle = meshes.add(shape::Cube::new(1.0)); + let mesh_handle = meshes.add(Cuboid::default()); [ (Color::BLUE, [-10.0, 0.0]), (Color::GREEN, [10.0, 0.0]), @@ -39,11 +39,7 @@ fn setup( commands.spawn(PbrBundle { mesh: mesh_handle.clone(), transform: Transform::from_xyz(x, 1.0, z), - material: materials.add(StandardMaterial { - base_color: color, - double_sided: true, - ..Default::default() - }), + material: materials.add(color), ..Default::default() }); }); @@ -58,7 +54,7 @@ fn spawn_cloth( let flag_texture = asset_server.load("Bevy.png"); let (size_x, size_y) = (60, 40); - let anchor_mesh = meshes.add(shape::Cube::new(1.0)); + let anchor_mesh = meshes.add(Cuboid::default()); let entity_a = commands .spawn(( PbrBundle { diff --git a/examples/balloon_example.rs b/examples/balloon_example.rs index a71b485..0db1e6a 100644 --- a/examples/balloon_example.rs +++ b/examples/balloon_example.rs @@ -29,7 +29,7 @@ fn setup( mut meshes: ResMut>, ) { commands.spawn(DirectionalLightBundle::default()); - let mesh_handle = meshes.add(shape::Cube::new(1.0)); + let mesh_handle = meshes.add(Cuboid::default()); [ (Color::BLUE, [-10.0, 0.0]), (Color::GREEN, [10.0, 0.0]), @@ -57,14 +57,7 @@ fn spawn_cloth( ) { commands.spawn(( PbrBundle { - mesh: meshes.add( - shape::Icosphere { - radius: 5.0, - subdivisions: 10, - } - .try_into() - .unwrap(), - ), + mesh: meshes.add(Sphere::new(5.).mesh().ico(10).unwrap()), material: materials.add(Color::YELLOW), transform: Transform::from_xyz(0.0, 2.0, 0.0), ..Default::default() diff --git a/examples/camera_plugin.rs b/examples/camera_plugin.rs index 21c21e8..8970329 100644 --- a/examples/camera_plugin.rs +++ b/examples/camera_plugin.rs @@ -31,7 +31,7 @@ pub fn handle_camera( mut cam_controls: Query<&mut Transform, With>, mut motion_evr: EventReader, mut scroll_evr: EventReader, - buttons: Res>, + buttons: Res>, time: Res