Compare commits
2 Commits
d9a8896444
...
0803b9d611
Author | SHA1 | Date |
---|---|---|
Zynh Ludwig | 0803b9d611 | |
Zynh Ludwig | edc9b376b9 |
10
src/main.rs
10
src/main.rs
|
@ -25,10 +25,10 @@ struct BoidBundle {
|
|||
boid: Boid,
|
||||
}
|
||||
|
||||
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>) {
|
||||
boids.iter_mut().for_each(|(mut transform, velocity)| {
|
||||
transform.translation += velocity.0;
|
||||
});
|
||||
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) {
|
||||
for (mut transform, velocity) in &mut boids {
|
||||
transform.translation += velocity.0 * time.delta_seconds();
|
||||
}
|
||||
}
|
||||
|
||||
fn setup(
|
||||
|
@ -47,7 +47,7 @@ fn setup(
|
|||
transform: Transform::from_scale(Vec3::splat(2.5)),
|
||||
..default()
|
||||
},
|
||||
velocity: Velocity(Vec3::Y),
|
||||
velocity: Velocity(Vec3::Y * 25.),
|
||||
..default()
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue