# [ODE] Re: center of mass

Jaroslav Sinecky jsinecky at tiscali.cz
Thu Oct 20 19:28:51 MST 2005

```I think you should first forget completly about geoms. Just imagine you have
a rigid body which has center of gravity and some mass - which determines
how much inertia it has moving around or rotating around various axis. Now
you can connect various rigis bodies by joints or apply forces or torques on

Now only for purpose of collisions you use geoms: if you need your body to
be collidable, you can give it some form by attaching one a more geoms to
your rigid body and you can create fixed geoms (with no body attached) to
create some environment to collide with.

And as a result of collision can be creating contact joints between rigid
bodies or between a rigid body and static environment.

Jaroslav

> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org]On Behalf
> Of Guillaume Jouffroy
> Sent: Thursday, October 20, 2005 3:50 PM
> To: Nagymathe Denes
> Cc: ode at q12.org
> Subject: Re: [ODE] Re: center of mass
>
>
> This is quite a clear explanation ;-)
>
> Now let me summarize things I know and what you told together to see if
> I got things as they should.
> If we virtually add a mass to each geom of a complex geom stuff;
> orienting each geom with geomtransform
> we need to do the same transformation to the mass as the mass position
> wont follow (but where is the mass at start ?
> cos we don't position it and we dont attach it... at 0,0,0 Am I right ?).
> Summing the masses build up a center of masses of the complex object,
> which is wherever placed.
> Now we need to put a rigid body to be linked to all these geoms. This
> rigidbody has to be at this center
> of mass (why moving the geoms instead of the body ? strange), so we set
> its position to the mass position
> vector mass.c.
> The example does moving geoms to this center of mass m:
>   for (k=0; k<2; k++) {
>     dGeomSetPosition (g2[k],
>               dpos[k][0]-m.c[0],
>               dpos[k][1]-m.c[1],
>               dpos[k][2]-m.c[2]);
>       }
>
> But then it moves the center of mass ????
> dMassTranslate (&m,-m.c[0],-m.c[1],-m.c[2]);
>
>
> And there is something strange too: I can't draw the right geomtransform
> geoms. Well I draw them but they do not move
> with the object if I don't use the same drawGeom function of the example
> i.e what is this for ? :
> dGeomID g2 = dGeomTransformGetGeom (g);         // I do that
> const dReal *pos2 = dGeomGetPosition (g2);           //that too
> const dReal *R2 = dGeomGetRotation (g2);            //this as well
>
> Then I think its sufficient but:
> dVector3 actual_pos;           /* I don't do this strange
> transformation */
> dMatrix3 actual_R;
> dMULTIPLY0_331 (actual_pos,R,pos2);
> actual_pos[0] += pos[0];
> actual_pos[1] += pos[1];
> actual_pos[2] += pos[2];
> dMULTIPLY0_333 (actual_R,R,R2);
>  drawGeom (g2,actual_pos,actual_R,0);
>
>
> Finally if I attach a joint to the rigidbody of a complex geoms object,
> I don't have any idea how
> the joint will be linked in reality between this complex object and
> another rigidbody. Do you ?
> To the closest geom virtually ?
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

```