diff --git a/common/src/sys/combat.rs b/common/src/sys/combat.rs index 726bda64a5..ade4446eee 100644 --- a/common/src/sys/combat.rs +++ b/common/src/sys/combat.rs @@ -54,7 +54,8 @@ impl<'a> System<'a> for Sys { stat_b .health .change_by(-10, HealthSource::Attack { by: *uid }); // TODO: variable damage and weapon - vel_b.0.z = 4.0; + vel_b.0 += (pos_b.0 - pos.0).normalized() * 5.0; + vel_b.0.z = 10.0; let _ = force_updates.insert(b, ForceUpdate); } } diff --git a/common/src/sys/movement.rs b/common/src/sys/movement.rs index ace0da8d7a..2966397071 100644 --- a/common/src/sys/movement.rs +++ b/common/src/sys/movement.rs @@ -109,6 +109,11 @@ impl<'a> System<'a> for Sys { } _ => 0.0, }; + + // Set direction based on move direction when on the ground + if Vec2::::from(move_dir.0).magnitude_squared() > 0.0001 { + ori.0 = Lerp::lerp(ori.0, Vec3::from(move_dir.0.normalized()), 4.0 * dt.0); + } } // Jump @@ -132,15 +137,6 @@ impl<'a> System<'a> for Sys { rollings.remove(entity); } } - - // Set direction based on velocity when on the ground - if Vec2::::from(vel.0).magnitude_squared() > 0.0001 { - ori.0 = Lerp::lerp( - ori.0, - vel.0.normalized() * Vec3::new(1.0, 1.0, 0.0), - 10.0 * dt.0, - ); - } } } }