From 6a3e244f5e6191a71fe2cea92c6b41d933c5beef Mon Sep 17 00:00:00 2001 From: rewin Date: Sat, 9 Dec 2023 15:08:18 +0300 Subject: [PATCH] Air resistance for walk controller (more realistic stopping behaviour) --- src/physics.rs | 8 +++++--- src/shepherd.rs | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 3a55f9a..3513719 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -4,6 +4,8 @@ use crate::GameSet; pub struct PhysicsPlugin; +const AIR_RESISTANCE: f32 = 0.5; + impl Plugin for PhysicsPlugin { fn build(&self, app: &mut App) { app.add_systems( @@ -32,11 +34,11 @@ pub struct WalkController { } fn walk_system(time: Res