From 164f248066ff960653829198196e862d47a7b828 Mon Sep 17 00:00:00 2001 From: Magnus von Wachenfeldt Date: Tue, 16 Aug 2022 21:31:07 +0200 Subject: [PATCH] normalized shooting direction. remove unnecessary prop --- shared/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared/src/lib.rs b/shared/src/lib.rs index 98bff1d..24d3ab2 100644 --- a/shared/src/lib.rs +++ b/shared/src/lib.rs @@ -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, }