rust/hwphysics/src/physics.rs
changeset 15266 b58f98bbc120
parent 15261 501dfa1c8deb
child 15270 7446258fab98
--- a/rust/hwphysics/src/physics.rs	Thu Jul 25 15:18:00 2019 +0200
+++ b/rust/hwphysics/src/physics.rs	Thu Jul 25 16:29:14 2019 +0300
@@ -101,6 +101,11 @@
             .zip(self.shifts.iter())
             .map(|(id, (from, to))| (id, from, to))
     }
+
+    pub fn clear(&mut self) {
+        self.gear_ids.clear();
+        self.shifts.clear();
+    }
 }
 
 impl PhysicsProcessor {
@@ -114,6 +119,7 @@
     }
 
     pub fn process(&mut self, time_step: FPNum) -> &PositionUpdates {
+        self.position_updates.clear();
         for (gear_id, (pos, vel)) in self.dynamic_physics.iter_pos_update() {
             let old_pos = *pos;
             *pos += *vel * time_step;