Don't modify position in glide character state

This commit is contained in:
James Melkonian 2021-05-23 07:26:11 +00:00 committed by Justin Shipsey
parent 95f3a12d41
commit 419cd2a5e4
4 changed files with 4 additions and 7 deletions

View File

@ -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 - /spawn command's auto-complete now works for species names
- Mindflayer AI now correctly summons husks at certain HP thresholds. - Mindflayer AI now correctly summons husks at certain HP thresholds.
- Far away NPCs respond to being damaged by a projectile - Far away NPCs respond to being damaged by a projectile
- Fixed terrain clipping with glider
## [0.9.0] - 2021-03-20 ## [0.9.0] - 2021-03-20

View File

@ -188,6 +188,8 @@ impl CharacterState {
pub fn is_dodge(&self) -> bool { matches!(self, CharacterState::Roll(_)) } 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 { pub fn is_melee_dodge(&self) -> bool {
matches!(self, CharacterState::Roll(d) if d.static_data.immune_melee) matches!(self, CharacterState::Roll(d) if d.static_data.immune_melee)
} }

View File

@ -177,12 +177,6 @@ impl CharacterBehavior for Data {
slerp_s, 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 { update.character = CharacterState::Glide(Self {
ori, ori,
last_vel: *data.vel, last_vel: *data.vel,

View File

@ -91,7 +91,7 @@ fn calc_z_limit(
char_state_maybe: Option<&CharacterState>, char_state_maybe: Option<&CharacterState>,
collider: Option<&Collider>, collider: Option<&Collider>,
) -> (f32, f32) { ) -> (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 0.5
} else { } else {
1.0 1.0