faster and time agnostic movement

main
Zynh Ludwig 2024-09-01 15:13:35 -07:00
parent d9a8896444
commit edc9b376b9
1 changed files with 3 additions and 3 deletions

View File

@ -25,9 +25,9 @@ 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)| { 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)), transform: Transform::from_scale(Vec3::splat(2.5)),
..default() ..default()
}, },
velocity: Velocity(Vec3::Y), velocity: Velocity(Vec3::Y * 25.),
..default() ..default()
}); });
} }