ODE Example bug ?

I have followed the example in the manual:
panda3d.etc.cmu.edu/wiki/index.p … n_with_ODE

It creates a number of cubes which free falls to a plane.

I’ve re-enabled the mouse by:


Also, the original code of the plane creation is:
ground = render.attachNewNode(cm.generate())
ground.setPos(0, 0, -1); ground.lookAt(0, 0, -2)
groundGeom = OdePlaneGeom(space, Vec4(0, 0, 1, 0))

The OdePlaneGeom shall create a plane of position (0,0,0) instead of (0,0,-1), is that right ? So I also change the code to:

ground.setPos(0, 0, 0); ground.lookAt(0, 0, -2)

Then I position the camera to near the level of the plane, to check if the boxes are rested correctly on the plane.

I take a screen capture here:
hk.myblog.yahoo.com/clcheunghk/a … =1&mid=678

The boxes are either at 0.5 below the plane, or at 1 above the plane.

It looks like the ode geom is not mapped correctly to panda’s boxes. Is it my problem only ?

I experienced similar problems when I tried the ODE examples. Posted a reply about it here:

I believe ODE’s boxes have their origin in the center, and the box meshes used in the tutorial have their origin at the base of the box. So when they are linked to each other they end up offset by half the box width.

One way to debug this is to make your own box and apply a texture map to it that has words such as top, front, etc. on it.

I made a quick set of test files you can use and posted them here:
The .zip file contains two .egg files and an image map.
Each .egg has a 1x1x1 box, but one has the pivot (origin) at the base, and the other has the pivot at its middle.

I agree that the official tutorials should be updated to get this right.

There is GeomTransform you can use to shift it.
Like this :

        # need the offset before any rotation

        if offset==Vec3(0):
           self.geom = ode.GeomBox(space, lengths=boundingBox)
           print 'CENTERED ORIGIN'
           realGeom=ode.GeomBox(None, lengths=boundingBox)
           self.geom = ode.GeomTransform(space)
           print 'NON-CENTERED ORIGIN'
        if density:  # create body if the object is dynamic, otherwise don't
           self.body = ode.Body(world)
           M = ode.Mass()
           M.setBox(density, *boundingBox)
           if nonCenteredO:

Thank you very much for your answers. It works correctly after using your fixed eggs / codes.

I have found another issue. I have modeled a floor and some walls. I don’t want to use OdePlaneGeom to match the room’s floor and walls one by one. So I try the OdeTriMeshGeom:

modelTrimesh = OdeTriMeshData(room, True)
modelGeom = OdeTriMeshGeom(space, modelTrimesh)

And it is not working. Collision is not detected most of the time. Searching around the forum, I found that adding flattenLight() seems fix the problem:

modelTrimesh = OdeTriMeshData(room, True)
modelGeom = OdeTriMeshGeom(space, modelTrimesh)

My understanding on the flattenLight() is the transformation of the position is made on the node at the moment of the call and no need to recompute it in later rendering. It is more on performance improvement.

So why the OdeTriMeshGeom is only working when the node is flatten ? Is it a bug there ? Or my understanding is not correct ?

Perhaps the children nodes’ vertices aren’t calculated relative to the parent of the given node (room).
If you don’t want to flatten the room, just create a copy of it.

If it is the case, may be it is better to fix the bug, otherwise the dynamic nodes will be calculated incorrectly ?

I think this is the expected behaviour actually. Without flattenLight, the nodes take their positions relative to the parent node. This would be fine with panda’s internal systems but in ODE there is no scene graph concept so ODE positions always need to be relative to render.

Well, it does seem like a poor integration of Panda and ODE. There’s no scene graph concept in OpenGL or DirectX, either, but Panda handles that for you pretty well. It ought to be able to handle the scene graph conversion to ODE objects also.

That being said, it sounds like it might be a fairly extensive reworking to provide a tighter integration with ODE, and I’m not in a position to do it myself. So unless someone else steps up to volunteer that, I don’t think it will happen soon. :confused:


I am very new to Panda. Does it mean that for dynamic trimesh ode objects, I have to flatten the node for every ode step ? For box and spheres, the current integration seems working well.

Hi ynjh_jo

If I want to use the panda ode instead of the standard ode, how can I do it ? I can’t find the corresponding OdeGeomTransform package to encapsulate the transform.

It’s already there, OdeGeom.setOffsetPosition.