diff -r 6ad92b6ac43c -r 701ad89a9f2a rust/hwphysics/src/physics.rs --- a/rust/hwphysics/src/physics.rs Thu Aug 29 00:08:03 2019 +0300 +++ b/rust/hwphysics/src/physics.rs Thu Aug 29 00:20:41 2019 +0300 @@ -57,12 +57,31 @@ pub fn new() -> Self { Self { - gravity: fp!(100), + gravity: fp!(1 / 10), position_updates: PositionUpdates::new(64), } } - pub fn process(&mut self, data: &mut GearDataManager, time_step: Millis) -> &PositionUpdates { + pub fn process_single_tick(&mut self, data: &mut GearDataManager) -> &PositionUpdates { + self.position_updates.clear(); + + data.iter_id( + |gear_id, (pos, vel): (&mut PositionData, &mut VelocityData)| { + let old_pos = pos.0; + vel.0 -= self.gravity; + pos.0 += vel.0; + self.position_updates.push(gear_id, &old_pos, &pos.0) + }, + ); + + &self.position_updates + } + + pub fn process_multiple_ticks( + &mut self, + data: &mut GearDataManager, + time_step: Millis, + ) -> &PositionUpdates { let fp_step = time_step.to_fixed(); self.position_updates.clear();