diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index f95d6b839a..b7ffcea028 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -14,7 +14,7 @@ const HUMANOID_ACCEL: f32 = 70.0; const HUMANOID_SPEED: f32 = 120.0; const HUMANOID_AIR_ACCEL: f32 = 10.0; const HUMANOID_AIR_SPEED: f32 = 100.0; -const HUMANOID_JUMP_ACCEL: f32 = 16.0; +const HUMANOID_JUMP_ACCEL: f32 = 17.0; const ROLL_ACCEL: f32 = 120.0; const ROLL_SPEED: f32 = 550.0; const GLIDE_ACCEL: f32 = 15.0; @@ -130,7 +130,7 @@ impl<'a> System<'a> for Sys { } // Set direction based on velocity - if vel.0.magnitude_squared() != 0.0 { + if vel.0.magnitude_squared() > 0.1 { ori.0 = vel.0.normalized() * Vec3::new(1.0, 1.0, 0.0); } @@ -146,7 +146,7 @@ impl<'a> System<'a> for Sys { // Basic collision with terrain let player_rad = 0.3f32; // half-width of the player's AABB - let player_height = 1.55f32; + let player_height = 1.5f32; // Probe distances let hdist = player_rad.ceil() as i32; @@ -253,8 +253,11 @@ impl<'a> System<'a> for Sys { // When the resolution direction is non-vertical, we must be colliding with a wall // If the space above is free... - if resolve_dir.z == 0.0 - && !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone()) + if !collision_with(pos.0 + Vec3::unit_z() * 1.1, near_iter.clone()) + && resolve_dir.z == 0.0 + && terrain.get((pos.0 - Vec3::unit_z()).map(|e| e.floor() as i32)) // Make sure we're close to the ground + .map(|vox| !vox.is_empty()) + .unwrap_or(false) { // ...block-hop! pos.0.z = (pos.0.z + 1.0).ceil();