From 44e245cfded1e7a9dfdda17d977ef26265bf3ba7 Mon Sep 17 00:00:00 2001 From: Franklin Date: Thu, 23 Nov 2023 14:03:20 -0400 Subject: [PATCH] Crouching is back, finally --- Design.md | 4 ++-- src/logic/core/player/camera_player_sync.rs | 7 +++---- src/logic/core/player/player_values_state.rs | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Design.md b/Design.md index f125b3a..8188716 100644 --- a/Design.md +++ b/Design.md @@ -18,11 +18,11 @@ Multiplayer # TODOs: - [x] Detach player rotation from character model - - [ ] Weapon Sway PENDING!!! + - [x] Weapon Sway - [x] Fixing leaning - [x] Snap back leaning too quick - [x] Issue with moving around quickly - - [ ] Bring Crouching back + - [x] Bring Crouching back - [ ] Inspect animation (procedural) - [ ] Reload animation (procedural) - [ ] Real world magazines diff --git a/src/logic/core/player/camera_player_sync.rs b/src/logic/core/player/camera_player_sync.rs index 57d4d02..8679dd8 100644 --- a/src/logic/core/player/camera_player_sync.rs +++ b/src/logic/core/player/camera_player_sync.rs @@ -53,15 +53,14 @@ pub fn update_camera_vertical_position( (delta / player_values_state.player_crouch_time_s).clamp(0.0, 1.0), ); } else { - // TODO: Add elapsed time to standup so that crouch time and standup time is the same. - /*camera_transform.translation = camera_transform.translation.lerp( + camera_transform.translation = camera_transform.translation.lerp( Vec3 { x: camera_transform.translation.x, y: player_values_state.player_camera_height, z: camera_transform.translation.z, }, - time.delta_seconds().clamp(0.0, 1.0), - );*/ + time.delta_seconds() / player_values_state.player_crouch_time_s, + ); } } diff --git a/src/logic/core/player/player_values_state.rs b/src/logic/core/player/player_values_state.rs index 5fc7854..eacb5e1 100644 --- a/src/logic/core/player/player_values_state.rs +++ b/src/logic/core/player/player_values_state.rs @@ -45,8 +45,8 @@ impl Default for PlayerValuesState { player_initial_weight: 75.0, player_gravity_scale: 4.0, player_height: 2.5, - player_camera_height: 1.25, - player_crouch_height: 0.0, + player_camera_height: 1.70858, + player_crouch_height: 1.0, player_crouch_time_s: 1.25, player_linear_damping: 3.5, player_linear_damping_while_jumping: 0.8,