Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/physics.py
diff options
context:
space:
mode:
Diffstat (limited to 'physics.py')
-rw-r--r--physics.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/physics.py b/physics.py
index 253ff1b..64e4ae1 100644
--- a/physics.py
+++ b/physics.py
@@ -66,6 +66,9 @@ class PhysicsGame:
self.loop = True
self.pygame_started = False
+ self.full_pos_list = []
+ self.tracked_bodies = []
+
def switch_off_fake_pygame_cursor_cb(self, panel, event):
self.show_fake_cursor = False
@@ -131,6 +134,24 @@ class PhysicsGame:
if self.world.run_physics:
for body in self.world.world.GetBodyList():
if type(body.userData) == type({}):
+ if body.userData.has_key('track_index'):
+ trackdex = body.userData['track_index']
+
+ def round_to_3(n):
+ return math.ceil(n * 1000) / 1000.0
+
+ roundx = round_to_3(body.position.x)
+ roundy = round_to_3(body.position.y)
+ tupled_pos = (roundx, roundy)
+ posx = tupled_pos[0]
+ posy = tupled_pos[1]
+ try:
+ self.full_pos_list[trackdex].append(posx)
+ self.full_pos_list[trackdex].append(posy)
+ except:
+ self.full_pos_list.append([posx, posy])
+
+ if type(body.userData) == type({}):
if body.userData.has_key('rollMotor'):
diff = body.userData['rollMotor'] \
['targetVelocity'] \