diff --git a/src/body.rs b/src/body.rs index 8dfe3f9..093c4b5 100644 --- a/src/body.rs +++ b/src/body.rs @@ -1,3 +1,5 @@ +use crate::event::EventStruct; + pub struct Body { pub position: glam::Vec3,//I64 where 2^32 = 1 u pub velocity: glam::Vec3,//I64 where 2^32 = 1 u/s @@ -65,8 +67,8 @@ impl PhysicsState { self.body.position+self.body.velocity*(dt as f32)+self.gravity*((0.5*dt*dt) as f32) } - fn next_strafe_event(&self) -> Option { - return Some(crate::event::EventStruct{ + fn next_strafe_event(&self) -> Option { + return Some(EventStruct{ time:(self.time/self.strafe_tick_period+1)*self.strafe_tick_period, event:crate::event::EventEnum::StrafeTick }); @@ -75,10 +77,10 @@ impl PhysicsState { impl crate::event::EventTrait for PhysicsState { //this little next event function can cache its return value and invalidate the cached value by watching the State. - fn next_event(&self) -> Option { + fn next_event(&self) -> Option { //JUST POLLING!!! NO MUTATION - let mut best_event: Option = None; - let collect_event = |test_event:Option|{ + let mut best_event: Option = None; + let collect_event = |test_event:Option|{ match test_event { Some(unwrap_test_event) => match best_event { Some(unwrap_best_event) => if unwrap_test_event.time