Search code examples
pythonpython-3.xpanda3d

How can I "attach" two OdeBodies together in panda3d?


I'm looking to firmly "attach" two bodies in panda3d so that their position and rotation do not change relative to each other, even over a distance. I have looked into joints, but none seem to do the trick. Is there any way to do this? Also, as a related question, is there a way to "anchor" a body so that it does not move at all, while still interacting with other objects physically? In the little documentation I have been able to locate, I have found this:

cm = CardMaker("ground")
cm.setFrame(-20, 20, -20, 20)
ground = render.attachNewNode(cm.generate())
ground.setPos(0, 0, 0)
groundGeom = OdePlaneGeom(world.space, Vec4(0, 0, 1, 0))

But I do not understand it and it seems to be something that must be done when the object is created, whereas I'm looking for something that can be done and undone at any time. Is there any way to do this?

This may not be a very well thought-out question; I'm very new to panda. If you need the code or any more information, I can post it. Thanks


Solution

  • The OdeFixedJoint class is designed to make a body retain a fixed position relative to another body or relative to the environment. Generally, however, it is better to represent two attached bodies as a single body instead.

    I believe that an object can be made static (anchored to the environment, if you will) by not assigning any body to it.