Made physics cheaper still

This commit is contained in:
Joshua Barretto 2019-06-27 15:37:33 +01:00
parent 6444ba1933
commit acb184e15d
2 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
#![type_length_limit = "1652471"] #![type_length_limit = "1664759"]
#![feature( #![feature(
euclidean_division, euclidean_division,
duration_float, duration_float,

View File

@ -145,12 +145,15 @@ impl<'a> System<'a> for Sys {
vel.0 = integrate_forces(dt.0, vel.0, friction); vel.0 = integrate_forces(dt.0, vel.0, friction);
// Basic collision with terrain // Basic collision with terrain
let player_rad = 0.3; // half-width of the player's AABB let player_rad = 0.3f32; // half-width of the player's AABB
let player_height = 1.7; let player_height = 1.55f32;
let dist = 2; // distance to probe the terrain for collisions // Probe distances
let near_iter = (-dist..=dist) let hdist = player_rad.ceil() as i32;
.map(move |i| (-dist..=dist).map(move |j| (-dist..=dist).map(move |k| (i, j, k)))) 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()
.flatten(); .flatten();