[ODE] Re: Translating a mass does not produce desired results

Ken F Endo ken at furo.org
Mon Jun 7 10:47:52 MST 2004


Hi
This is the first time for me to reply the mailing list

  I think your method  is not good because this causes the wrong result.
your method is to add force caused by gravity  at the center of mass. 
But, this also cause
moment around the center of body. So, the body begins to rotate even 
if the body is falling just because of
gravity. Moreover, ODE calculates all behavior of body around each 
center of body. (not center of mass)

ODE has the function about the center of mass. But, it does not seem 
available. Is there anyone who solve it?
I think ODE has to be updated right now!!.


Ken F Endo

>Hi
>
>I had similar problem with car mass translation.
>I have found that gravity applied in step and stepfast functions ignore mass
>translation.
>
>I don't know this is best and correct solution, but enough for me.
>In step and stepfast - gravity is applied to center of body - not center of
>mass!
>Change that to AddForceAtPos with pos = center of mass defined in body.mass
>
>You may do this that: (step.cpp & stepfast.cpp)
>(find world->gravity string and replace FOR loop)
>-----------------------------------------------------
>for (i=0; i<nb; i++)
>{
>     if ((body[i]->flags & dxBodyNoGravity) == 0)
>     {
>         dVector3 massTranslation;
>         dBodyVectorToWorld(body[i], body[i]->mass.c[0], body[i]->mass.c[1],
>body[i]->mass.c[2], massTranslation);
>         dBodyAddForceAtPos(body[i],
>                                             body[i]->mass.mass *
>world->gravity[0],
>                                             body[i]->mass.mass *
>world->gravity[1],
>                                             body[i]->mass.mass *
>world->gravity[2],
>                                             body[i]->pos[0] +
>massTranslation[0],
>                                             body[i]->pos[1] +
>massTranslation[1],
>                                             body[i]->pos[2] +
>massTranslation[2]);
>     }
>}
>
>-----------------------------------------------------
>
>
>Regards
>Andrzej Zacharewicz
>Techland
>zachar at techland.pl
>
>>
>>  Hi,
>>
>>  I have a function that creates a cylinder and in it I do the following:
>>
>>     dMass m;
>>     dMassSetCappedCylinderTotal(&m,1.0,3,radius,length);
>>     dMassTranslate(&m, 0.15, 0, 0);
>>
>>     Object* obj = newObject();
>>     obj->body = dBodyCreate(world);
>>     dBodySetMass (obj->body,&m);
>>
>>  However, despite the fact that the mass has been translated to the
>>  "side" of the cylinder it does not roll.  Can anyone explain why this
>>  is so?
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode



More information about the ODE mailing list