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

Garvin Haslett G.A.Haslett at sussex.ac.uk
Wed May 26 15:42:52 MST 2004


Some follow up questions, two for Andrzej and one for the rest of the 
list.

Andrzej,

Thanks, I have done the search for world->gravity and I notice that 
there are three instances of the for loop.  One in stepfast.cpp and two 
in step.cpp.  I assume you mean that all three should be altered.

Next, can I assume you found this fix stable and efficient?

Rest of list,

Is this a bug?  It seems strange that ODE has a mass translation 
function but requires this hack to allow the integrator to use it.  I 
would also be interested to know what people's opinions are about the 
stability of this fix.

Thanks,

Garvin.


On 25 May 2004, at 08:01, Andrzej Zacharewicz wrote:

> 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?
>



More information about the ODE mailing list