Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/physics.py
diff options
context:
space:
mode:
authorasaf <asafpm@gmail.com>2009-08-08 23:26:26 (GMT)
committer asaf <asafpm@gmail.com>2009-08-08 23:26:26 (GMT)
commit31161c2862e4696a22cbd34fb63db5d2d33014d2 (patch)
tree295bffff27db2310ea1d3b23e2c3514c8f387c39 /physics.py
parentf9a2b906db2bcdfe91a411fe5c67cbafeee79153 (diff)
Added "Roll" tool
Diffstat (limited to 'physics.py')
-rw-r--r--physics.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/physics.py b/physics.py
index 6179206..dba7368 100644
--- a/physics.py
+++ b/physics.py
@@ -56,6 +56,13 @@ class PhysicsGame:
self.currentTool.handleEvents(event)
# Clear Display
self.screen.fill((255,255,255)) #255 for white
+
+ if self.world.run_physics:
+ for body in self.world.world.GetBodyList():
+ if type(body.userData) == type({}):
+ if body.userData.has_key('rollMotor'):
+ diff = body.userData['rollMotor']['targetVelocity']- body.GetAngularVelocity()
+ body.ApplyTorque(body.userData['rollMotor']['strength']*diff*body.getMassData().I)
# Update & Draw World
self.world.update()