diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index e5a737a82f..ca4115e9a2 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -126,13 +126,14 @@ impl<'a> System<'a> for Sys { vel.0 = integrate_forces(dt.0, vel.0, downward_force, friction); // Don't move if we're not in a loaded chunk - let pos_delta = if terrain + let mut pos_delta = if terrain .get_key(terrain.pos_key(pos.0.map(|e| e.floor() as i32))) .is_some() { // this is an approximation that allows most framerates to // behave in a similar manner. - (vel.0 + old_vel.0 * 4.0) * dt.0 * 0.2 + let dt_lerp = 0.2; + (vel.0 * dt_lerp + old_vel.0 * (1.0 - dt_lerp)) * dt.0 } else { Vec3::zero() }; @@ -294,7 +295,7 @@ impl<'a> System<'a> for Sys { .unwrap_or(false)) // ...and there is a collision with a block beneath our current hitbox... && collision_with( - old_pos + resolve_dir - Vec3::unit_z() * 1.05, + pos.0 + resolve_dir - Vec3::unit_z() * 1.05, &|block| block.is_solid(), near_iter.clone(), ) @@ -309,6 +310,7 @@ impl<'a> System<'a> for Sys { vel.0 = vel.0.map2(resolve_dir, |e, d| { if d * e.signum() < 0.0 { 0.0 } else { e } }); + pos_delta *= resolve_dir.map(|e| if e != 0.0 { 0.0 } else { 1.0 }); } // Resolve the collision normally diff --git a/voxygen/src/scene/camera.rs b/voxygen/src/scene/camera.rs index 451e60c7cb..54a96974c2 100644 --- a/voxygen/src/scene/camera.rs +++ b/voxygen/src/scene/camera.rs @@ -214,14 +214,8 @@ impl Camera { }, ); - // Snap when close enough in x/y, but lerp otherwise - if (self.focus.xy() - self.tgt_focus.xy()).magnitude_squared() > 2.0f32.powf(2.0) { - self.focus.x = lerped_focus.x; - self.focus.y = lerped_focus.y; - } else { - self.focus.x = self.tgt_focus.x; - self.focus.y = self.tgt_focus.y; - } + self.focus.x = lerped_focus.x; + self.focus.y = lerped_focus.y; // Always lerp in z self.focus.z = lerped_focus.z;