khkhyvctyctcggc

This commit is contained in:
griffi-gh 2023-01-18 19:10:58 +01:00
parent cd20b4ae32
commit 3a446b675b
2 changed files with 9 additions and 0 deletions

View file

@ -16,6 +16,7 @@ glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math"]
hashbrown = "0.13" hashbrown = "0.13"
noise = "0.8" noise = "0.8"
rayon = "1.6" rayon = "1.6"
#ordered-float = "3.4"
[features] [features]
default = [] default = []

View file

@ -23,9 +23,17 @@ impl BasicPhysicsActor {
self.position += self.velocity; self.position += self.velocity;
loop { loop {
let block_pos = self.position.floor().as_ivec3(); let block_pos = self.position.floor().as_ivec3();
let block_pos_f = block_pos.as_vec3a();
if let Some(block) = world.try_get(block_pos) { if let Some(block) = world.try_get(block_pos) {
match block.descriptor().collision { match block.descriptor().collision {
Some(super::blocks::CollisionType::Solid) => { Some(super::blocks::CollisionType::Solid) => {
let position_delta = self.position - block_pos_f;
let distance_to_zero = position_delta.abs();
let distance_to_one = (vec3a(1., 1., 1.) - position_delta).abs();
// let mut max_distance = 0;
// let mut max_distance_normal = 0;
// distance_to_one.x
//todo compute restitution here //todo compute restitution here
} }
_ => break _ => break