From 2fe2b81da5265b7d86ca96f54bdf484efd71b471 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Fri, 9 Feb 2007 17:52:18 +0000 Subject: [PATCH] OdeJoint extension definitions --- direct/src/extensions/OdeJoint-extensions.py | 11 ++++++++ .../extensions_native/OdeJoint_extensions.py | 27 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 direct/src/extensions/OdeJoint-extensions.py create mode 100755 direct/src/extensions_native/OdeJoint_extensions.py diff --git a/direct/src/extensions/OdeJoint-extensions.py b/direct/src/extensions/OdeJoint-extensions.py new file mode 100755 index 0000000000..1befcbddb7 --- /dev/null +++ b/direct/src/extensions/OdeJoint-extensions.py @@ -0,0 +1,11 @@ +def attach(self, body1, body2): + """ + Attach two bodies together. + If either body is None, the other will be attached to the environment. + """ + if body1 and body2: + self.attachBodies(body1, body2) + elif body1 and not body2: + self.attachBody(body1, 0) + elif not body1 and body2: + self.attachBody(body2, 1) diff --git a/direct/src/extensions_native/OdeJoint_extensions.py b/direct/src/extensions_native/OdeJoint_extensions.py new file mode 100755 index 0000000000..2d247554dd --- /dev/null +++ b/direct/src/extensions_native/OdeJoint_extensions.py @@ -0,0 +1,27 @@ + +from extension_native_helpers import * +from libpanda import * + +#################################################################### +#Dtool_funcToMethod(func, class) +#del func +##################################################################### + +""" +ODE-extensions module: contains methods to extend functionality +of the ODE classes +""" + +def attach(self, body1, body2): + """ + Attach two bodies together. + If either body is None, the other will be attached to the environment. + """ + if body1 and body2: + self.attachBodies(body1, body2) + elif body1 and not body2: + self.attachBody(body1, 0) + elif not body1 and body2: + self.attachBody(body2, 1) +Dtool_funcToMethod(attach, OdeJoint) +del attach