normalized shooting direction. remove unnecessary prop

This commit is contained in:
Magnus von Wachenfeldt 2022-08-16 21:31:07 +02:00
parent 05ca78229f
commit 164f248066
Signed by: magnus
GPG Key ID: A469F7D71D09F795

View File

@ -153,11 +153,10 @@ pub fn spawn_projectile(commands: &mut Commands, origin: Vec2, direction: Vec2)
)))
//.insert(Collider::ball(0.1))
.insert(RigidBody::Dynamic)
.insert(Velocity::linear(direction))
.insert(Velocity::linear(direction.normalize() * 130.))
//.insert(ActiveEvents::COLLISION_EVENTS)
.insert(Projectile {
duration: Timer::from_seconds(3.5, false),
direction,
})
.id()
}
@ -165,5 +164,4 @@ pub fn spawn_projectile(commands: &mut Commands, origin: Vec2, direction: Vec2)
#[derive(Debug, Component)]
pub struct Projectile {
pub duration: Timer,
pub direction: Vec2,
}