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

Garvin Haslett G.A.Haslett at sussex.ac.uk
Thu May 27 15:24:33 MST 2004


Hmm, I've added the code and the cylinder rolls OK.  The problem now is 
that it doesn't stop rolling.  The ODE friction model does not seem to be 
damping the roll at all.

Any clues?

--On 26 May 2004 16:53 +0200 Andrzej Zacharewicz <zachar at techland.pl> wrote:

> Hi.
>
>> ... I assume you mean that all three should be altered.
> Yes, some of them are not used- but you can replace them all of course.
>
>> Next, can I assume you found this fix stable and efficient?
> This is stable because there are nothing special. We always add gravity
> force - this is only translation of point where force is applied.
> We use that in our game "Xpand Rally" http://xr.techland.pl and everything
> seems to be good.
>
> Regards...
> Andrzej Zacharewicz
> Techland
> zachar at techland.pl
>
>
> ----- Original Message -----
> From: "Garvin Haslett" <G.A.Haslett at sussex.ac.uk>
> To: "Andrzej Zacharewicz" <zachar at techland.pl>
> Cc: <G.A.Haslett at sussex.ac.uk>; <ode at q12.org>
> Sent: Wednesday, May 26, 2004 4:42 PM
> Subject: Re: Translating a mass does not produce desired results
>
>
>> 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