Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/elements
diff options
context:
space:
mode:
authorAlex <alex@Tiresias.(none)>2008-07-07 20:40:59 (GMT)
committer Alex <alex@Tiresias.(none)>2008-07-07 20:40:59 (GMT)
commitf6e388f082c6c110e4f1eea014858aac3d5e6e4d (patch)
treecb5433c3a2e4d6e5a81dcdcc3d552596cf0c6495 /elements
parentb3d8fe9d61c02482243fe43548721aa0b88b54e4 (diff)
Modified the joint tool to allow for fixed joints
Diffstat (limited to 'elements')
-rw-r--r--elements/add_objects.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/elements/add_objects.py b/elements/add_objects.py
index b93c479..7954852 100644
--- a/elements/add_objects.py
+++ b/elements/add_objects.py
@@ -476,9 +476,24 @@ class Add:
elif len(args) == 3:
# Revolute Joint
pass
-
+
+ elif len(args) == 2:
+
+ # Revolute Joint to the Background, don't assume the center of the body
+ b1 = self.parent.world.GetGroundBody()
+ b2 = args[0]
+ p1 = self.parent.to_world(args[1])
+ p1x, p1y = p1
+ p1x /= self.parent.ppm
+ p1y /= self.parent.ppm
+ p1 = box2d.b2Vec2(p1x, p1y)
+
+ jointDef = box2d.b2RevoluteJointDef()
+ jointDef.Initialize(b1, b2, p1)
+
+ self.parent.world.CreateJoint(jointDef)
elif len(args) == 1:
- # Revolute Joint to the Background
+ # Revolute Joint to the Background, assume the center of the body
b1 = self.parent.world.GetGroundBody()
b2 = args[0]
p1 = b2.GetWorldCenter()