[ODE] Fwd: noob question: non-uniform distribution of mass

Gaffiere gaffiere at gmail.com
Wed Apr 25 15:30:35 MST 2007


Hi Mark!
First of all thanks for your answer.
I've tried to offset the geom by the COM value using:

    dMass m;
    dMassSetParameters(&m, TotalMass, \
                        CombinedCG[0], CombinedCG[1], CombinedCG[2], \
                        Ixx, Iyy, Izz, \
                        Ixy, Ixz, Iyz);
    dGeomSetBody(geom,body);
    dGeomSetOffsetPosition (geom, m.c[0], m.c[1], m.c[2]);
    dBodySetMass(body,&m);

The result is that now the body seems to fall down correctly but when it
hits another object, it penetrates it as it was translated. I'm sure I'm
forgetting something :S Do you have any example to show me?

Thanks
Thomas
2007/4/24, Mark Williams <mark at image-engine.com>:
>
>
> I may be wrong about this but I believe the centre of rotation is always
> the centroid of the body, regardless of the COM set in the dMass
> properties. I think you need to offset your geom by -0.3, -0.3, -0.3.
>
> Cheers,
> Mark
>
> > Hi at all!
> > first of all sorry for my bad English :)
> >
> > I'm trying to implement a cube with a non uniform distribution of mass.
> > Image to have 8 point Mass in the 8 cube's vertices : as read in the
> > O'Reilly book "Physics for Game Developers", first I had calculated the
> > center of gravity, then the Inertia tensor. Since they are point Mass
> > they don't have local Inertia (is it right?)
> > Result from dBodyGetMass seem correct, infact:
> >
> > width, height, depth = 1
> > mass in:
> > pos M0: -0.5, -0.5, -0.5  -> 1.3
> > pos M1: 0.5, -0.5, -0.5   -> 0.1
> > pos M2: -0.5 , -0.5, 0.5   -> 0.1
> > pos M3: 0.5, -0.5, 0.5    -> 0.1
> > pos M4: -0.5, 0.5, -0.5   -> 0.1
> > pos M5: 0.5, 0.5, -0.5    -> 0.1
> > pos M6: -0.5, 0.5, 0.5    -> 0.1
> > pos M7: 0.5, 0.5, 0.5     -> 0.1
> >
> >         non uniform distribution mass:
> >
> > center of gravity in:
> > -0.3, -0.3, -0.3
> > Inertia Tensor
> > 0.64, 0.12, 0.12
> > 0.12, 0.64, 0.12
> > 0.12, 0.12, 0.64
> >
> >         uniform distribution mass:
> > center of gravity
> > 0, 0, 0
> > Inertia Tensor
> > 0.333333, 0, 0
> > 0, 0.333333, 0
> > 0, 0, 0.333333
> >
> > Now the question:
> > If I left fall down both cubes over an thin and alligned obstacle with
> > their "visual" center, why do they remain in balance over it? should not
> > the "non uniform" cube continue to fall to the ground with rotation in
> > accord the bigger mass is located?
> >
> > Here it is how I setup the non uniform cube:
> >
> > body = dBodyCreate(world);
> > geom = dCreateBox(space,width,height,depth);
> > /* here I put the 8 puntual Mass, the code for Combined Center of
> Gravity
> > and Inertia Tensor, as suggested in the O'Reilly book "Physics for Game
> > Developers" */
> >
> > dMass m;
> > dMassSetParameters(&m, TotalMass, \
> >                     CombinedCG[0], CombinedCG[1], CombinedCG[2], \
> >                     Ixx, Iyy, Izz, \
> >                     Ixy, Ixz, Iyz);
> > dBodySetMass(body,&m);
> > dGeomSetBody(geom,body);
> >
> >
> > TIA
> > Thomas
> > --
> > from ash reborn fire
> > Dalla cenere rinascere Fuoco
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ODE mailing list
> > ODE at ode.org
> > http://ode.org/mailman/listinfo/ode
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>

-- 
Dalla cenere rinascere Fuoco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ode.org/pipermail/ode/attachments/20070426/2d702061/attachment.htm


More information about the ODE mailing list