From addde65caab74f1e3eb0e2864af3cb04281d2982 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Fri, 8 Sep 2023 15:55:33 -0700 Subject: [PATCH] fix up next_event lsp errors --- src/body.rs | 14 +++++++++++--- src/main.rs | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/body.rs b/src/body.rs index c6f4eb6e..2caa81bd 100644 --- a/src/body.rs +++ b/src/body.rs @@ -9,6 +9,7 @@ pub struct Body { pub struct PhysicsState { pub body: Body, pub contacts: Vec, + pub models_cringe_clone: Vec, pub time: TIME, pub strafe_tick_num: TIME, pub strafe_tick_den: TIME, @@ -213,6 +214,12 @@ impl PhysicsState { //check if you are accelerating towards a walk target velocity and create an event return None; } + fn predict_collision_end(&self,model:&Model) -> Option { + None + } + fn predict_collision_start(&self,model:&Model) -> Option { + None + } } impl crate::event::EventTrait for PhysicsState { @@ -230,11 +237,12 @@ impl crate::event::EventTrait for PhysicsState { } //check for collision stop events with curent contacts for collision_data in self.contacts.iter() { - best.collect(self.predict_collision(collision_data.model)); + best.collect(self.predict_collision_end(self.models_cringe_clone.get(collision_data.model as usize).unwrap())); } //check for collision start events (against every part in the game with no optimization!!) - for &model in self.world.models { - best.collect(self.predict_collision(&model)); + for model in &self.models_cringe_clone { + best.collect(self.predict_collision_start(model)); + } if self.grounded { //walk maintenance best.collect(self.next_walk_event()); diff --git a/src/main.rs b/src/main.rs index 8bba40c6..652a04fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,6 +308,7 @@ impl strafe_client::framework::Example for Skybox { jump_trying: false, walkspeed: 18.0, contacts: Vec::::new(), + models_cringe_clone: modeldatas.iter().map(|m|crate::body::Model{transform:m.transform}), }; let camera_uniforms = camera.to_uniform_data(physics.extrapolate_position(0));