[ODE] dGeom offsets without bodies?
Geoff Carlton
gcarlton at iinet.net.au
Wed Feb 15 20:15:32 MST 2006
Hi,
Geoms with bodyless offsets seem a nice idea, particularly since there
is a spare offset_posr pointer that could be used for this purpose.
However there are a few reasons I didn't go down that road.
If you look at the code, you see the transforms are contained in a
dxPosR structure (a position and rotation). Geoms have two posr
pointers, final_posr and offset_posr. An offset geom currently gets the
body's posr for its base transform, but if we wanted to support offsets
without bodies, you'd need to add an extra "base_posr" field in geom,
with a memory cost for all users. Either that, or provide the transform
manually on demand, which means the geom can no longer recalculate
itself properly without outside help.
Besides, with or without a base_posr, it wouldn't work out as nicely as
it seems. When bodies are moved, they signal that fact to all attached
geoms, and those geoms then know to recalculate their position. How
would we signal the group of bodyless geoms that the base transform has
moved? If the answer is to do it externally, in addition to the geoms
not having their own base_posr, then really the client code has to do
most the work anyway.
Instead, a nice feature might be to extract out the bits of transform
math to make it easy for clients to do this sort of stuff themselves.
That way the clients can have all sorts of transform hierarchies, with
nested transforms, etc, that get flattened down to a single transform in
ode. Something like:
void dGetFinalPosition(const dxPosR& base, const dxPosR& offset,
dxPosR& final)
void dGetOffsetPosition(const dxPosR& base, const dxPosR& final,
dxPosR& offset)
void dGetBasePosition(const dxPosR& offset, const dxPosR& final,
dxPosR& base)
The only complication is that dxPosR isn't exposed to the client, as it
is a implementation class only.
Geoff
More information about the ODE
mailing list