[ODE] Slow down sphere

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Aug 22 15:47:49 MST 2006


When things are not flat, then the ball will accelerate in the direction 
of slope anyway, as you would expect. The velocity reduction (or, I 
prefer, adding a counter-force and counter-torque) is a fine way to 
dampen movement and simulate rolling friction or air drag.

Cheers,

          / h+


aldoric at gmx.de wrote:
> Hi!
>
> I've got a sphere and a trimesh (as world). I want the sphere to get slower if the ball is on a flat part of it (or of anything).
>
> My first solution was something like that:
>
> vel = (dReal*)dBodyGetLinearVel(ballBody);
> vel[0] *= 0.994f;
> vel[1] *= 0.994f;
> vel[2] *= 0.994f;
> dBodySetLinearVel(ballBody,vel[0],vel[1],vel[2]);
> 			
> vel = (dReal*)dBodyGetAngularVel(ballBody);
> vel[0] *= 0.994f;
> vel[1] *= 0.994f;
> vel[2] *= 0.994f;
> dBodySetAngularVel(ballBody,vel[0],vel[1],vel[2]);
>
>
> The problem is, that this solution doesn't work very fine for everything else than flat grounds.
>
> Is there another solution for that?
>
> Thanks :)
>   


More information about the ODE mailing list