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,
|
boid: Boid,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>) {
|
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) {
|
||||||
boids.iter_mut().for_each(|(mut transform, velocity)| {
|
for (mut transform, velocity) in &mut boids {
|
||||||
transform.translation += velocity.0;
|
transform.translation += velocity.0 * time.delta_seconds();
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup(
|
fn setup(
|
||||||
|
@ -47,7 +47,7 @@ fn setup(
|
||||||
transform: Transform::from_scale(Vec3::splat(2.5)),
|
transform: Transform::from_scale(Vec3::splat(2.5)),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
velocity: Velocity(Vec3::Y),
|
velocity: Velocity(Vec3::Y * 25.),
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue