# [ODE] Calculating G force

Jon Watte (ODE) hplus-ode at mindcontrol.org
Fri May 5 08:15:26 MST 2006

The linear velocity is already in world coordinates. Thus, all you need
to do is to subtract the linear velocity from the last step from the
linear velocity in this step, and divide by time (as you're doing), and
you get the force of the aggregate impulse. Then subtract gravity.

Cheers,

/ h+

Anders Olofsson wrote:
> Well, it didn't work that good.. Am I thinking this all wrong?.
>
> dVector3 vel,oldvel,force;
> void CalculateGForces (dBodyID body)
> {
>          const dReal *tmp;
>          dVector3 tmpv;
>
>          tmp=dBodyGetLinearVel (body);
>          dBodyVectorFromWorld (body, tmp[0], tmp[1], tmp[2], tmpv);
>          vel[0]=tmpv[0];
>          vel[1]=tmpv[1];
>          vel[2]=tmpv[2];
>          if (dtime>0){
>                  force[0]=(vel[0]-oldvel[0])/dtime;
>                  force[1]=(vel[1]-oldvel[1])/dtime;
>                  force[2]=(vel[2]-oldvel[2])/dtime;
>          }
>          oldvel[0]=vel[0];
>          oldvel[1]=vel[1];
>          oldvel[2]=vel[2];
> }
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>
>