From 664c5dd1200853903feaf4581954386a806e8a51 Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 13 Sep 2023 10:36:25 -0400 Subject: [PATCH] Fixed bugs with movement system --- Readme.md | 4 +++- assets/skybox/.DS_Store | Bin 6148 -> 6148 bytes src/constants/player_values.rs | 2 +- src/logic/core/player/player_vertical_sync.rs | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index afd3ea9..c12d810 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,5 @@ # Experimental game -- [ ] Skybox +- [x] Skybox +- [x] Glitch: Fall does not remove linear damping, only after jump +- [x] Glitch: Negative linear damping on jump allows for bunny hopping diff --git a/assets/skybox/.DS_Store b/assets/skybox/.DS_Store index 9b4ea73e30b81ffc83b5d9f12f1252080580a3d2..770175c323375a6dc85f2b7b3c5caae9d0155b09 100644 GIT binary patch delta 84 zcmZoMXfc=|#>B`mu~2NHo+2aj!~pBb0*nnnMo+dd7eg^aHbW&t5<@;i1%n<#0Yl!# lYqe~f**W+*fOC%r9cd!N|bC&;Z1nJw)~}0|0Ik6NUf) delta 65 zcmZoMXfc=|#>CJ*u~2NHo+2aD!~pBb1|lqz`57}duV##4n|y$A%Vu^Ceh#3T%^MlN VGf(ChF=S+zY{MhHIYwj!GXQo963YMp diff --git a/src/constants/player_values.rs b/src/constants/player_values.rs index f0e5b19..7f4cb28 100644 --- a/src/constants/player_values.rs +++ b/src/constants/player_values.rs @@ -13,7 +13,7 @@ pub const PLAYER_CAMERA_HEIGHT: f32 = 1.0; pub const PLAYER_CROUCH_HEIGHT: f32 = 0.0; pub const PLAYER_LINEAR_DAMPING: f32 = 3.5; -pub const PLAYER_LINEAR_DAMPING_WHILE_JUMPING: f32 = -0.5; +pub const PLAYER_LINEAR_DAMPING_WHILE_JUMPING: f32 = 0.25; pub const PLAYER_LATERAL_ACCELERATION_WHILE_SPRINTING_MULTIPLIER: f32 = 0.2; pub const PLAYER_LATERAL_ACCELERATION_MULTIPLIER: f32 = 1.0; diff --git a/src/logic/core/player/player_vertical_sync.rs b/src/logic/core/player/player_vertical_sync.rs index 7cc1618..81b66c9 100644 --- a/src/logic/core/player/player_vertical_sync.rs +++ b/src/logic/core/player/player_vertical_sync.rs @@ -1,7 +1,7 @@ use bevy::prelude::*; use bevy_rapier3d::prelude::*; -use crate::{comps::core::markers::player::Player, constants::player_values::{PLAYER_LINEAR_DAMPING, PLAYER_JUMP_COOLDOWN_MS, PLAYER_LINEAR_DAMPING_TIME_OFFSET_AFTER_JUMP_IN_MS}}; +use crate::{comps::core::markers::player::Player, constants::player_values::{PLAYER_LINEAR_DAMPING, PLAYER_JUMP_COOLDOWN_MS, PLAYER_LINEAR_DAMPING_TIME_OFFSET_AFTER_JUMP_IN_MS, PLAYER_LINEAR_DAMPING_WHILE_JUMPING}}; use super::player_movement::PlayerLinearYState; @@ -13,6 +13,7 @@ pub fn sync_player_y_state( for (player_velocity, mut player_linear_y_state, mut player_damping) in &mut query { if player_velocity.linvel.y < -1.0 { *player_linear_y_state = PlayerLinearYState::Falling; + *player_damping = Damping { linear_damping: PLAYER_LINEAR_DAMPING_WHILE_JUMPING, ..Default::default() }; } else if player_velocity.linvel.y >= -1.0 && player_velocity.linvel.y <= 1.0 { let previous_grounded_time = match *player_linear_y_state { PlayerLinearYState::Grounded(grounded_for) => grounded_for,