Skip to content

Commit

Permalink
examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ManevilleF committed Feb 20, 2024
1 parent d8286c7 commit 2ca165b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 22 deletions.
10 changes: 3 additions & 7 deletions examples/anchors_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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()
});
});
Expand All @@ -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 {
Expand Down
11 changes: 2 additions & 9 deletions examples/balloon_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
) {
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]),
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion examples/camera_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn handle_camera(
mut cam_controls: Query<&mut Transform, With<CameraController>>,
mut motion_evr: EventReader<MouseMotion>,
mut scroll_evr: EventReader<MouseWheel>,
buttons: Res<Input<MouseButton>>,
buttons: Res<ButtonInput<MouseButton>>,
time: Res<Time>,
) {
let delta_time = time.delta_seconds();
Expand Down
2 changes: 1 addition & 1 deletion examples/flag_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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]),
Expand Down
4 changes: 2 additions & 2 deletions examples/moving_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn setup(
mut materials: ResMut<Assets<StandardMaterial>>,
mut meshes: ResMut<Assets<Mesh>>,
) {
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]),
Expand Down Expand Up @@ -85,7 +85,7 @@ fn spawn_cloth(
.with_children(|b| {
b.spawn((
PbrBundle {
mesh: meshes.add(shape::Cube::new(2.0).into()),
mesh: meshes.add(Cuboid::new(2.0, 2.0, 2.0)),
material: materials.add(Color::WHITE),
transform: Transform::from_xyz(10.0, 0.0, 0.0),
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion examples/rapier_collision_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn setup(
transform: Transform::from_rotation(Quat::from_rotation_y(5.0)),
..Default::default()
});
let mesh_handle = meshes.add(shape::Cube::new(2.0));
let mesh_handle = meshes.add(Cuboid::new(2.0, 2.0, 2.0));
[
(Color::BLUE, [-10.0, 0.0]),
(Color::GREEN, [10.0, 0.0]),
Expand Down
2 changes: 1 addition & 1 deletion examples/xpbd_collision_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn setup(
transform: Transform::from_rotation(Quat::from_rotation_y(5.0)),
..Default::default()
});
let mesh_handle = meshes.add(shape::Cube::new(2.0));
let mesh_handle = meshes.add(Cuboid::new(2.0, 2.0, 2.0));
[
(Color::BLUE, [-10.0, 0.0]),
(Color::GREEN, [10.0, 0.0]),
Expand Down

0 comments on commit 2ca165b

Please sign in to comment.