diff --git a/src/body.rs b/src/body.rs index 1d55a959..85ecd4e1 100644 --- a/src/body.rs +++ b/src/body.rs @@ -19,6 +19,7 @@ pub type TIMESTAMP = i64; const CONTROL_JUMP:u32 = 0b01000000;//temp impl PhysicsState { + //delete this, we are tickless gamers pub fn run(&mut self, time: TIMESTAMP, control_dir: glam::Vec3, controls: u32){ let target_tick = (time/10_000_000) as u32;//100t //the game code can run for 1 month before running out of ticks @@ -55,8 +56,19 @@ impl PhysicsState { self.body.time=target_tick as TIMESTAMP*10_000_000; } + //delete this pub fn extrapolate_position(&self, time: TIMESTAMP) -> glam::Vec3 { 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) } +} + +impl crate::event::EventTrait for PhysicsState { + fn next_event(&self) -> Option { + //check for collision stop events with curent contacts + //check for collision start events against (every part in the ghamemem!!) + //check to see if yee need to jump + //check to see when the next strafe tick is + None + } } \ No newline at end of file diff --git a/src/event.rs b/src/event.rs index 16f9b2e5..2fa2a05e 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,8 +1,10 @@ -enum EventEnum { - //Body::CollisionStart - //Body::CollisionEnd +pub enum EventEnum { + CollisionStart(crate::body::TIMESTAMP),//,Collideable),//Body::CollisionStart + CollisionEnd(crate::body::TIMESTAMP),//,Collideable),//Body::CollisionEnd + StrafeTick(crate::body::TIMESTAMP), + Jump(crate::body::TIMESTAMP), } pub trait EventTrait { - fn next_event() -> EventEnum; + fn next_event(&self) -> Option; } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 2aaeac4a..b229c530 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,2 +1,3 @@ pub mod framework; pub mod body; +pub mod event;