[ODE] Object hierarchies
jean-sebastien.guay at polymtl.ca
Wed Mar 29 13:41:46 MST 2006
I am making a program where the meshes I load are in a hierarchy. More
specifically, every object looks like this:
--- Root (no geometry)
|--- child1 (geometry)
|--- child2 (geometry)
|--- child2.1 (geometry)
|--- child3 (geometry)
There could be any number of children to any node, including the root. Also,
some objects need to be mobile, others not.
I am trying to find the best way to represent this in ODE. I have read the
User's Guide and there are two recommendations that apply: immobile objects
should have no rigid body object, only a geom, and I can represent a hierarchy
of objects with geomTransforms.
So for now, here's what I have:
- The root has no geom and only has a body if the object needs to be mobile.
- Sub-objects have a geom and a geomTransform linked to the geom. If the main
object is mobile, the geomTransform is linked to the root's body. (which means
that there are multiple geoms linked to one body - is that OK?)
What I'm having trouble with is transformations. Is there a way to link
geomTransforms to something even if the object needs to be immobile? It seems
like that would simplify things a lot, since then in all cases I could just
move the root node's object and all the children would follow. If not, would
the right way of doing it be that I move all the geomTransforms from the root
down by the same amount if I need to move an immobile object?
(I know "moving an immobile object" is a contradiction, but I need to place the
objects in the world somehow...)
Most of this is implemented, but I'm having problems with collision detection
(as my past messages have shown) and I thought I might need to see if the basic
ideas in what I'm doing are right. I really have a feeling that sub-objects are
not where I think they are in the world, which would be why two objects do not
collide when I think they should.
In general, am I approaching this the right way? Has anyone done something
similar in the past? I thought of merging all the sub-objects into a single
object by just appending the vertex and triangle lists together, but that would
probably be more work than necessary and I would have to special-case it when
some parts of an object need to move independently from the rest.
And in case anyone asks, I can't change the way the object hierarchy is
constructed. We have an exporter that exports objects from 3D Studio Max, and
that's how it exports them...
Thanks in advance,
Jean-Sebastien Guay jean-sebastien.guay at polymtl.ca
More information about the ODE