forked from StrafesNET/strafe-client
fix up next_event lsp errors
This commit is contained in:
parent
2c4e6f642b
commit
addde65caa
14
src/body.rs
14
src/body.rs
@ -9,6 +9,7 @@ pub struct Body {
|
|||||||
pub struct PhysicsState {
|
pub struct PhysicsState {
|
||||||
pub body: Body,
|
pub body: Body,
|
||||||
pub contacts: Vec<RelativeCollision>,
|
pub contacts: Vec<RelativeCollision>,
|
||||||
|
pub models_cringe_clone: Vec<Model>,
|
||||||
pub time: TIME,
|
pub time: TIME,
|
||||||
pub strafe_tick_num: TIME,
|
pub strafe_tick_num: TIME,
|
||||||
pub strafe_tick_den: 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
|
//check if you are accelerating towards a walk target velocity and create an event
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
fn predict_collision_end(&self,model:&Model) -> Option<EventStruct> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
fn predict_collision_start(&self,model:&Model) -> Option<EventStruct> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl crate::event::EventTrait for PhysicsState {
|
impl crate::event::EventTrait for PhysicsState {
|
||||||
@ -230,11 +237,12 @@ impl crate::event::EventTrait for PhysicsState {
|
|||||||
}
|
}
|
||||||
//check for collision stop events with curent contacts
|
//check for collision stop events with curent contacts
|
||||||
for collision_data in self.contacts.iter() {
|
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!!)
|
//check for collision start events (against every part in the game with no optimization!!)
|
||||||
for &model in self.world.models {
|
for model in &self.models_cringe_clone {
|
||||||
best.collect(self.predict_collision(&model));
|
best.collect(self.predict_collision_start(model));
|
||||||
|
}
|
||||||
if self.grounded {
|
if self.grounded {
|
||||||
//walk maintenance
|
//walk maintenance
|
||||||
best.collect(self.next_walk_event());
|
best.collect(self.next_walk_event());
|
||||||
|
@ -308,6 +308,7 @@ impl strafe_client::framework::Example for Skybox {
|
|||||||
jump_trying: false,
|
jump_trying: false,
|
||||||
walkspeed: 18.0,
|
walkspeed: 18.0,
|
||||||
contacts: Vec::<crate::body::RelativeCollision>::new(),
|
contacts: Vec::<crate::body::RelativeCollision>::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));
|
let camera_uniforms = camera.to_uniform_data(physics.extrapolate_position(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user