# [ODE] dMassTranslate

Auro auro.ghosh at gmail.com
Thu Jun 1 00:25:37 MST 2006

```Hi guys,

if it's of any help I'll try and explain how I got it to work on my PC. You
have to use a combination of TransformGeom to offset the actual geom
(cylinder) and massTranslate to shift the mass to the new CM of the shifted
shape.

Explanation (an attempt):
A solidbody is represented by only a single point (pos, orientation...). An
analytical shape (cylinder) has a predefined point of reference (it's centre
(I think). When u attach a shape to the body its poiont of reference gets
mapped to the point of the solidbody. Similarly when u compute the mass
properties (Inertia Tensor specifically) for an analytical shape (cylinder)
it is computed by default for its point of reference (the centre). Now just
shifting the mass from the CM (the solidbody point which now coincides with
the reference point of the shape and the reference point of the mass of the
same shape - think inertia tensor), only changes mass properties. But the
shape (the body as u see on ur screen) will still rotate around the CM. So u
need to also offset the Shape the same amount as the mass, so that now with
both the mass and shape shifted away from the CM the whole body will behave
differently (ponderously). Rotations of the body will happen around the CM
which is now offset with respect to both the mass and the shape.

Hope this helps folks.....
Cheers,
-Auro

On 6/1/06, Geoff Carlton <gcarlton at iinet.net.au> wrote:
>
> Hi,
> I don't think dMassTranslate has ever allowed the centre of mass to move
> around from a body, despite its name.
>
> If you are using the RC, an alternative to the dGeomTransform is simply
> to set the offsets directly:
>
>   geom = dCreateBox(0, 1.0f, 2.0f, 3.0f);
>   body = dBodyCreate(world);
>   dGeomSetBody(geom, body);
>   dGeomSetOffsetPosition(geom, 100.0f, 0.0f, 0.0f);
>   // now body is at 0,0,0 and geom at 100,0,0
>   // either call dBodySetPosition(body, -100.0f, 0.0f, 0.0f);
>   // or else call dGeomSetPosition(geom, 0.0f, 0.0f, 0.0f);
>   // now body is at -100,0,0 and geom at 0,0,0
>
> Geoff
>
> Bram Stolk wrote:
> > Mauro G. Todeschini wrote:
> >
> >> Hi,
> >>      I've tryed to use dMassTranslate to translate the mass of a
> cylinder
> >> but my body doesn't react in the expected way.
> >> I thought that if I have a body in 0,0,0 (es. a cylinder with the axis
> >> parallel to world x axis, ad the relative geom), and I dMassTranslate
> >> Its mass to (-100, 0, 0) it should react as if I had a cylinder in
> >> (-100, 0, 0) World coordinates and I attached a transformed geometry at
> >> (0,0,0) world coordinates (whis react as expected).
> >> Ok, I was not that clear but I hope you understand :)
> >> Perhaps dMassTranslate is buggy?
> >> I'm using a version of ODE I downloaded from CVS about 3 menth ago.
> >> Perhaps now It has been fixed?
> >>
> >
> > for what it's worth... I couldnt get it to work properly either.
> > (recent svn tree).
> >
> > Either we're both incompetent, or there's a bug :-)
> >
> > My sim behaved like the mass was not translated at all.
> >
> >    bram
> >
> >
> >
> >> Bye and Thanks
> >> _______________________________________________
> >> ODE mailing list
> >> ODE at q12.org
> >> http://q12.org/mailman/listinfo/ode
> >>
> >
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> >
> >
> >
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>

--
-----------------------------
- Aurobrata Ghosh -
+91-9873159692
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060601/8cdff285/attachment-0001.htm
```

More information about the ODE mailing list