From 5decd48db68d22ee69910bbda30c7a5853b52eee Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Wed, 26 Jun 2019 10:55:08 +0100 Subject: [PATCH] Used velocity bias for collision correction --- common/src/lib.rs | 2 +- common/src/sys/phys.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/lib.rs b/common/src/lib.rs index a774a9efe2..75d1064937 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,4 +1,4 @@ -#![type_length_limit="1615607"] +#![type_length_limit="1652471"] #![feature( euclidean_division, duration_float, diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index b3cd700318..9cb2504663 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -221,7 +221,7 @@ impl<'a> System<'a> for Sys { .get(*block_pos) .map(|vox| !vox.is_empty()) .unwrap_or(false)) - .max_by_key(|(_, block_aabb)| ((player_aabb.collision_vector_with_aabb(*block_aabb) * Vec3::new(1.0, 1.0, 10.0)).map(|e| e.abs()).reduce_partial_min() * 200.0) as i32) + .max_by_key(|(_, block_aabb)| ((player_aabb.collision_vector_with_aabb(*block_aabb) / vel.0).map(|e| e.abs()).reduce_partial_min() * 1000.0) as i32) .expect("Collision detected, but no colliding blocks found!"); let dir = player_aabb.collision_vector_with_aabb(block_aabb);