faster and time agnostic movement
This commit is contained in:
parent
d9a8896444
commit
edc9b376b9
1 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue