[ODE] Re: A (hopefully) simple collision response question

Tim Schmidt tisch at uni-paderborn.de
Tue May 14 14:09:01 2002


dJointAttach(c, dGeomGetBody(contacts[i].geom.g1),
dJointAttach (c, dGeomGetBody(o1), dGeomGetBody(o2));

I have also come across this problem. 
When using groups as in the test_buggy demo one have to attach the joint with
the bodies that you get from the geometries that are stored in the contact
struct (-> dGeomGetBody(contacts[i].geom.g1)). But this will fail when
transforms are used, because the encapsulated geometries are not associated with
any body. So the result of dGeomGetBody(contacts[i].geom.g1) should be 0, while
a call to dGeomGetBody(o1) should give you the right value.
Maybe one can solve that problem by testing o1 and o2 in the nearcallback if
they are groups or not, but in your case of grouped transforms that should fail,

In the meantime I am experimenting with a new geometry class, that should behave
like a TransformGroup known from Java3D (and maybe other libraries with a
similar scene graph representation). With this class one can consistently use
the dGeomGetBody(o1) solution. And furthermore it is possible to build an
arbitrarily structured tree of objects that are each positioned relative to the
particular parent node.

If you have a (very simple ;-) ) plane for example, there is one root node
associated with the plane's body and another three transformgroups placed
'under' this node. One with the fuselage (cappedcylinder) under it and two with
the underlying wings (flat boxes). And if you want to add engines, simply put
them 'next to' the wings under another two transformgroups.

bodyTG ---> associated with dBody
    |   |
    |   +--fuselageCylinder
    |   |
    |   +--wingBox
    |   |
    |   +--leftengineTG
    |         |
    |         +--leftengineCylinder

I have already sent the corresponding source code to Russ to hear his opinion,
but I havn't got an answer so far. Of course I can send this experimental code
to anybody who is interested, but use it on your own responsibility ;-)