Here's a patch for the attach() method of joints
to allow one of the bodies to be None. This
allows you to create a joint which connects
a body to the fixed environment.
--
Greg
--- Soya-0.11.2-orig/ode/joints.pyx 2006-06-09 09:37:45.000000000 +1200
+++ Soya-0.11.2/ode/joints.pyx 2006-07-01 14:33:36.000000000 +1200
@@ -124,18 +124,30 @@
@type body2: Body
"""
+ cdef dBodyID bid1, bid2
+
if self.body1 is not None:
self.body1._remove_joint(self)
if self.body2 is not None:
self.body2._remove_joint(self)
-
+
+ if body1 is not None:
+ # Make sure the bodies keep a
reference to the joint so that
+ # the user doesn't have to
+ body1._add_joint(self)
+ bid1 = body1._bid
+ else:
+ bid1 = NULL
+
+ if body2 is not None:
+ body2._add_joint(self)
+ bid2 = body2._bid
+ else:
+ bid2 = NULL
+
self.body1 = body1
self.body2 = body2
- dJointAttach(self.jid, body1._bid, body2._bid)
- # Make sure the bodies keep a reference to the
joint so that
- # the user doesn't have to
- body1._add_joint(self)
- body2._add_joint(self)
+ dJointAttach(self.jid, bid1, bid2)
# # getBody
# def get_body(self, index):
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user