# [ODE] Re: center of mass

Nagymathe Denes denes at invictus.hu
Fri Oct 21 14:05:53 MST 2005

```Hi,

>> Note that the pos and R of geoms within geomtransform means their
>> _relative_ pos and R in respect to the cm, doesn't matter where they are
>> in  world coordinates.
>>
> Damn is that written in the documentation ??
I'm sure it is. Maybe a bit differently.
It says (what i've found):
"T mimics the object E that it encapsulates: T is inserted into a space and
attached to a body as though
it was E. E itself must not be inserted into a space or attached to a body.
>>>E's position and rotation are set
to constant values that say how it is transformed relative to T.<<< If E's
position and rotation are left at their
default values, T will behave exactly like E would have if you had used it
directly."

> When you get coordinates for body, these coordinates are world ones you
> can use to draw things at the right place. I can't find where it is said
> you get
> object reference coordinates for geomtransform ! How do you know ? Write a
> new documentation you know so much about what's hidden. I try to do a tuto
> but I need to get things clear first. It will be a "ode concepts for
> noobs" ;-)
:o)

>> Yes. You could move the body instead of moving all the geoms. In that
>> case you'd have to rotate mass.c with R and add the result to the
>> original pos. Simpler than moving the geoms, right. The only difference
>> is that in this case the cm of the resulting compound object wouldn't be
>> exactly at the originally given position.
>>
> Ehm.. rotate ?
mass.c was calculated in body-relative coordinates, so you have to shift the
body CM in that coordinate system; but you set body pos in world-space, so
the world-space shift is mass.c rotated from body-space to worldspace. (ok,
you need inverse rotation... :)

> And why it won't be exactly at the originally position ? Is that cos
> rotation transformation  is approximative, I guess ?
It's because we've created the 3 geoms in random (relative) positions with
random masses, without taking care about the sum.
So we have to pay for our lazyness. :o)

>> Yes. Now, as you've corrected the relative positions of the geoms, and
>> the body is exactly at the cm, you need centered cm for the body, aren't
>> you? :o)
>
> Well I don't  :-x
> Actually I try not to use what I don't understand and see whats going on.
> "centered cm" ...If I move my body to the cm isn't the cm supposed to be
> the center of the rb ?
It is. :o) That's why you have to clear mass.c. You only needed it to know
where to move the body, but you don't need it anymore as the two positions
are just right.

> Oh I have no problem with the real body cos I had a headache with that
> before ;-)
> The thing that put me into confusion is the picture in the documentation
> for the hinge. Look at the relative position of the objects to each other
> and the joint direction.
> Will the joint work fine if there isnt this alignment ? My complex geom
> structure is a kind of axe forming a L. One part of the L is actually the
> axe for the wheel, and the other will go to a chassis. Its like the wheel
> of the (I don't know the word) thing we push in supermarkets. If the rb is
> not in alignment like in the other part of the L, won't there be a problem
> ?
No. It will work perfectly with any axis. :o) In fact it will even work
perfectly if you pull or turn your bodies apart and 'he' must pull them back
again to match the two positions and axes again. (see ERP)

Denes

```