diff --git a/src/body.rs b/src/body.rs index a382f912..361b7528 100644 --- a/src/body.rs +++ b/src/body.rs @@ -7,6 +7,7 @@ pub struct Body { pub struct PhysicsState { pub body: Body, pub time: TIME, + pub strafe_tick_rate: TIME, pub tick: u32, pub gravity: glam::Vec3, pub friction: f32, @@ -61,6 +62,13 @@ impl PhysicsState { let dt=(time-self.body.time) as f64/1_000_000_000f64; 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{ + time:self.time/self.strafe_tick_rate*self.strafe_tick_rate,//this is floor(n) I need ceil(n)+1 + event:crate::event::EventEnum::StrafeTick + }); + } } impl crate::event::EventTrait for PhysicsState { diff --git a/src/main.rs b/src/main.rs index cd6c9a1f..6504badc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -299,6 +299,7 @@ impl strafe_client::framework::Example for Skybox { }, time: 0, tick: 0, + tick_rate: 100, gravity: glam::Vec3::new(0.0,-100.0,0.0), friction: 90.0, mv: 2.7,