[ODE] Re: dynamic add of geom and mass to a body
Adam D. Moss
aspirin at ntlworld.com
Sat Sep 6 01:41:03 2003
Guillermo Andrade-Barroso wrote:
>>>> See the boxstack demo for details. I'm thinking of the compound
>>>> object.
>>
>> The last time I checked, I'm pretty sure that the boxstack demo
>> didn't actually do this right.
>
> Exact!
> Take a compound object from boxstack demo, this object has a center of
> mass that coincides with its reference position and all initial geoms
> (and perhaps
> some joints) are attached to this body.
> Now, you need to add another geom.In this case, the new geom changes mass,
> inertia and center of mass of body. Because the implementation of ODE
> needs to preserve coincidence between center of mass and position of
> reference, you
> need to change position of body and relative position of all geoms (and
> all joints) attached.
Yeah, I wish I could provide a simple answer.
I've licked this in my engine, but it was a real nightmare. I'm
going to have to revisit this part soon to make it properly
scriptable, so if it all starts to look simpler than it originally
did I'll post a summary. (Actually IIRC the ODE side isn't that
bad, conceptually, it's just kinda horrifying to get this integrated
with a scenegraph because of the tangle of relative transformations
(world-relative, modelview-relative, body-relative) needed to
adjust the geoms' offset relative to the body while tieing the
rendered mesh corresponding to the geoms in the right place,
but that's perhaps a peculiarity of the way my engine disentangles
mesh from body from geom from mass)...
--Adam
--
Adam D. Moss . ,,^^ adam@gimp.org http://www.foxbox.org/ co:3
"I am NOT a nut! I am the keeper of the seven universal truths!"