mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
Slow down the many_cubes example (#4117)
# Objective - After #4015, the `many_cubes` example could introduce discomfort in some cases ## Solution - Slow down the camera, add space between the cubes https://user-images.githubusercontent.com/8672791/156898412-0fcd29b4-63b1-4e11-bf52-7ec40cb8f932.mp4
This commit is contained in:
parent
cf46baa172
commit
159fe527a8
1 changed files with 13 additions and 9 deletions
|
@ -28,33 +28,37 @@ fn setup(
|
|||
});
|
||||
for x in 0..WIDTH {
|
||||
for y in 0..HEIGHT {
|
||||
// introduce spaces to break any kind of moiré pattern
|
||||
if x % 10 == 0 || y % 10 == 0 {
|
||||
continue;
|
||||
}
|
||||
// cube
|
||||
commands.spawn_bundle(PbrBundle {
|
||||
mesh: mesh.clone_weak(),
|
||||
material: material.clone_weak(),
|
||||
transform: Transform::from_xyz((x as f32) * 2.0, (y as f32) * 2.0, 0.0),
|
||||
transform: Transform::from_xyz((x as f32) * 2.5, (y as f32) * 2.5, 0.0),
|
||||
..default()
|
||||
});
|
||||
commands.spawn_bundle(PbrBundle {
|
||||
mesh: mesh.clone_weak(),
|
||||
material: material.clone_weak(),
|
||||
transform: Transform::from_xyz(
|
||||
(x as f32) * 2.0,
|
||||
HEIGHT as f32 * 2.0,
|
||||
(y as f32) * 2.0,
|
||||
(x as f32) * 2.5,
|
||||
HEIGHT as f32 * 2.5,
|
||||
(y as f32) * 2.5,
|
||||
),
|
||||
..Default::default()
|
||||
});
|
||||
commands.spawn_bundle(PbrBundle {
|
||||
mesh: mesh.clone_weak(),
|
||||
material: material.clone_weak(),
|
||||
transform: Transform::from_xyz((x as f32) * 2.0, 0.0, (y as f32) * 2.0),
|
||||
transform: Transform::from_xyz((x as f32) * 2.5, 0.0, (y as f32) * 2.5),
|
||||
..Default::default()
|
||||
});
|
||||
commands.spawn_bundle(PbrBundle {
|
||||
mesh: mesh.clone_weak(),
|
||||
material: material.clone_weak(),
|
||||
transform: Transform::from_xyz(0.0, (x as f32) * 2.0, (y as f32) * 2.0),
|
||||
transform: Transform::from_xyz(0.0, (x as f32) * 2.5, (y as f32) * 2.5),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
@ -66,7 +70,7 @@ fn setup(
|
|||
mesh,
|
||||
material,
|
||||
transform: Transform {
|
||||
translation: Vec3::new(0.0, HEIGHT as f32 * 2.0, 0.0),
|
||||
translation: Vec3::new(0.0, HEIGHT as f32 * 2.5, 0.0),
|
||||
scale: Vec3::splat(5.0),
|
||||
..Default::default()
|
||||
},
|
||||
|
@ -87,8 +91,8 @@ fn setup(
|
|||
// System for rotating the camera
|
||||
fn move_camera(time: Res<Time>, mut camera_query: Query<&mut Transform, With<Camera>>) {
|
||||
let mut camera_transform = camera_query.single_mut();
|
||||
camera_transform.rotate(Quat::from_rotation_z(time.delta_seconds() * 0.5));
|
||||
camera_transform.rotate(Quat::from_rotation_x(time.delta_seconds() * 0.5));
|
||||
camera_transform.rotate(Quat::from_rotation_z(time.delta_seconds() * 0.15));
|
||||
camera_transform.rotate(Quat::from_rotation_x(time.delta_seconds() * 0.15));
|
||||
}
|
||||
|
||||
// System for printing the number of meshes on every tick of the timer
|
||||
|
|
Loading…
Reference in a new issue