[ODE] rolling ball

Geoff Carlton gcarlton at iinet.net.au
Fri Jul 1 17:41:38 MST 2005


There are a few different ways.  Firstly, you _can_ just set the 
velocity directly, depending on the sort of results you want to get.  
Probably not a good idea, but you can try it and see.  Alternatively you 
can determine the amount of force to apply each step.  For instance:
  velocity_diff = velocity_target - velocity_current;
  force = K * velocity_diff

The trick is coming up with a good value of K, which you can get by 
trial and error.  You can then expand the scheme for trickier effects - 
e.g. a stronger acceleration at the start, then then ramping it off as 
we approach the max speed.  There's lots of things to play with to get 
unique control over the "avatar" object.  Good luck!

Geoff


Vianney Lecroart wrote:

>Hello guys,
>
>I have a ball rolling on a floor (a big box). I can control it with
>arrow keys. When I press the up key, the ball accelerates. I use
>dBodyAddForce() to do that. I want that the ball, when the guy keep
>the up key down, is rolling at a maximum velocity (for example 50km/h)
>but since I use a add force, the ball always accelerate. The problem
>is that I cannot control the velocity and I cannot clamp it because,
>in the ode doc, they said it s bad to setup manually the velocity, and
>it can generate bad behaviors. They also say that we should use a
>AMotor joint to control the velocity but in my case, I have only one
>body (the ball) and the AMotor requires 2 body.
>
>What is the best way to resolve this problem?
>
>Regards,
>Vianney Lecroart
>
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode
>
>
>  
>



More information about the ODE mailing list