From 419cd2a5e4eaa507fd8515a733195a596751ff5d Mon Sep 17 00:00:00 2001 From: James Melkonian Date: Sun, 23 May 2021 07:26:11 +0000 Subject: [PATCH] Don't modify position in glide character state --- CHANGELOG.md | 1 + common/src/comp/character_state.rs | 2 ++ common/src/states/glide.rs | 6 ------ common/systems/src/phys.rs | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dff6ff7633..23fba0ed3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -137,6 +137,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - /spawn command's auto-complete now works for species names - Mindflayer AI now correctly summons husks at certain HP thresholds. - Far away NPCs respond to being damaged by a projectile +- Fixed terrain clipping with glider ## [0.9.0] - 2021-03-20 diff --git a/common/src/comp/character_state.rs b/common/src/comp/character_state.rs index d73be47340..4e40b2ac6c 100644 --- a/common/src/comp/character_state.rs +++ b/common/src/comp/character_state.rs @@ -188,6 +188,8 @@ impl CharacterState { pub fn is_dodge(&self) -> bool { matches!(self, CharacterState::Roll(_)) } + pub fn is_glide(&self) -> bool { matches!(self, CharacterState::Glide(_)) } + pub fn is_melee_dodge(&self) -> bool { matches!(self, CharacterState::Roll(d) if d.static_data.immune_melee) } diff --git a/common/src/states/glide.rs b/common/src/states/glide.rs index 7932a13f3c..72aed78390 100644 --- a/common/src/states/glide.rs +++ b/common/src/states/glide.rs @@ -177,12 +177,6 @@ impl CharacterBehavior for Data { slerp_s, ) }; - update.pos.0 = { - // offset character pos such that it's the center of rotation is not around the - // character - let center_off = data.body.height() * 0.7; - update.pos.0 + *data.ori.up() * center_off - *update.ori.up() * center_off - }; update.character = CharacterState::Glide(Self { ori, last_vel: *data.vel, diff --git a/common/systems/src/phys.rs b/common/systems/src/phys.rs index 6b20254f94..d0b94f794b 100644 --- a/common/systems/src/phys.rs +++ b/common/systems/src/phys.rs @@ -91,7 +91,7 @@ fn calc_z_limit( char_state_maybe: Option<&CharacterState>, collider: Option<&Collider>, ) -> (f32, f32) { - let modifier = if char_state_maybe.map_or(false, |c_s| c_s.is_dodge()) { + let modifier = if char_state_maybe.map_or(false, |c_s| c_s.is_dodge() || c_s.is_glide()) { 0.5 } else { 1.0