[ODE] [PATCH] dBodyAddImpulse() etc functionality

Russ Smith russ at q12.org
Sat Jul 13 13:15:02 2002

> The attached patch adds impulse accumulators and the following
> functions to ODE:
> dBodyAddImpulse
> dBodyAddRelImpulse
> dBodyAddImpulseAtPos
> dBodyAddImpulseAtRelPos
> dBodyAddRelImpulseAtPos
> dBodyAddRelImpulseAtRelPos

i thought about adding these impulse functions to ODE, but in the end i
have replaced these six functions (and the 8 extra reals in dBody) by a
much simpler solution: a single function called dWorldImpulseToForce().
to apply impulses to bodies, you can do this:

    // convert impulse ix,iy,iz to a force
    dVector3 force;
    dWorldImpulseToForce (world,stepsize, ix,iy,iz, force);
    // add the force
    dBodyAddForceXXX (body, force[0],force[1],force[2])
    dWorldStep (world, stepsize);

if that seems like a mouthful then you can just do this directly

    // add the scaled impulse as a force
    dBodyAddForceXXX (body, ix/stepsize,iy/stepsize,iz/stepsize);
    dWorldStep (world, stepsize);

the dWorldImpulseToForce() function is basically just a bit of
code-as-documentation for the above division by stepsize.

this is a lot simpler for ODE, i think. this will be checked into CVS
later today, and the new docs uploaded.


Russell Smith