faster and time agnostic movement

This commit is contained in:
Zynh Ludwig 2024-09-01 15:13:35 -07:00
parent d9a8896444
commit edc9b376b9

View file

@ -25,9 +25,9 @@ struct BoidBundle {
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)| {
transform.translation += velocity.0;
transform.translation += velocity.0 * time.delta_seconds();
});
}
@ -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()
});
}