Hi Mizipzor,
You aren't keeping references to your ode.Joint objects, so they're
getting deallocated. Try this patch:
--- xorig.py 2007-04-22 10:11:33.000000000 +0100
+++ x.py 2007-04-22 10:20:41.000000000 +0100
@@ -3,8 +3,8 @@
world = None # the gravity world
worldscale = 1
-
-class Joint():
+objs=[]
+class Joint:
""" a joining between two ropes """
def __init__(self, mass, radius, length, parent, attachPoint):
#create the mass
@@ -31,13 +31,14 @@
#create the joint
j = ode.BallJoint(world)
+ objs.append(j)
if parent == None:
j.attach(self.body, ode.environment)
if not parent == None:
j.attach(self.body, parent.body)
j.setAnchor((attachPoint[0],attachPoint[1],0))
-class Rope():
+class Rope:
""" a rope """
def __init__(self, topPosition, joints, mass, radius, length):
self.joints = []
Incidentally, you don't need to explicitly compare to None either...
you can just do 'if parent: x.. if not parent: ...' which looks
cleaner.
|