vec2 velocity thank goodness
This commit is contained in:
parent
a5400fafaa
commit
5561191864
1 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@ fn main() {
|
||||||
struct Boid;
|
struct Boid;
|
||||||
|
|
||||||
#[derive(Component, Default)]
|
#[derive(Component, Default)]
|
||||||
struct Velocity(Vec3);
|
struct Velocity(Vec2);
|
||||||
|
|
||||||
#[derive(Bundle, Default)]
|
#[derive(Bundle, Default)]
|
||||||
struct BoidBundle {
|
struct BoidBundle {
|
||||||
|
@ -27,7 +27,7 @@ struct BoidBundle {
|
||||||
|
|
||||||
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) {
|
fn move_boids(mut boids: Query<(&mut Transform, &Velocity), With<Boid>>, time: Res<Time>) {
|
||||||
for (mut transform, velocity) in &mut boids {
|
for (mut transform, velocity) in &mut boids {
|
||||||
transform.translation += velocity.0 * time.delta_seconds();
|
transform.translation += velocity.0.extend(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 * 100.),
|
velocity: Velocity(Vec2::Y * 100.),
|
||||||
..default()
|
..default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue