From acb184e15d1fc4e4ed834cb8a2000cae40d079f3 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Thu, 27 Jun 2019 15:37:33 +0100 Subject: [PATCH] Made physics cheaper still --- common/src/lib.rs | 2 +- common/src/sys/phys.rs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/common/src/lib.rs b/common/src/lib.rs index 28d881aefa..4a2b6dcaa2 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,4 +1,4 @@ -#![type_length_limit = "1652471"] +#![type_length_limit = "1664759"] #![feature( euclidean_division, duration_float, diff --git a/common/src/sys/phys.rs b/common/src/sys/phys.rs index cd51d6ae32..f95d6b839a 100644 --- a/common/src/sys/phys.rs +++ b/common/src/sys/phys.rs @@ -145,12 +145,15 @@ impl<'a> System<'a> for Sys { vel.0 = integrate_forces(dt.0, vel.0, friction); // Basic collision with terrain - let player_rad = 0.3; // half-width of the player's AABB - let player_height = 1.7; + let player_rad = 0.3f32; // half-width of the player's AABB + let player_height = 1.55f32; - let dist = 2; // distance to probe the terrain for collisions - let near_iter = (-dist..=dist) - .map(move |i| (-dist..=dist).map(move |j| (-dist..=dist).map(move |k| (i, j, k)))) + // Probe distances + let hdist = player_rad.ceil() as i32; + let vdist = player_height.ceil() as i32; + // Neighbouring blocks iterator + let near_iter = (-hdist..=hdist) + .map(move |i| (-hdist..=hdist).map(move |j| (0..=vdist).map(move |k| (i, j, k)))) .flatten() .flatten();