[ODE] ? about dAddBodyForce

Jon Watte (ODE) hplus-ode at mindcontrol.org
Mon Aug 21 15:19:00 MST 2006


1) add wind drag, such that at the desired velocity, 100 force is 
exactly what's lost to wind drag

or

2) scale the force backward by proximity to the maximum velocity

  float curVel = vector_length(myObjectLinearVelocity());
  float force = 100 * (1 - curVel / MAXIMUM_VELOCITY);
  dBodyAddRelForce(myBody, 0, 0, force); // assuming "forward" is positive Z

Cheers,

          / h+


Jeff Kershner wrote:
>
> When I press the forward key in my application I call dBodyAddForce 
> and add 100 to the forward direction.  But as I hold down the forward 
> key, my speed seems to keep increasing forever.  How do I set a 
> maximum speed?
>
>  
>
> I tried doing the following:
>
>  
>
> const dReal* pForce = dBodyGetForce(id);
>
>  
>
> But pForce[0], pForce[1] and pForce[2] are always 0.  I realize that 
> ODE will clear these values to 0 at every frame, so this is not the 
> way to do it!
>
>  
>
> How else can I do this?
>
> /jk
>



More information about the ODE mailing list