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

Gaffiere gaffiere at gmail.com
Tue Apr 24 13:19:19 MST 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ode.org/pipermail/ode/attachments/20070424/979a2ecf/attachment.htm


More information about the ODE mailing list