[ODE] velocity problem
arnaud lapeyrade
nonolap at club-internet.fr
Sun Mar 7 18:12:49 MST 2004
hello!!
I have a a problem to setting body velocity. I want to move a cube by
applying forces. I have to use some formules (in my subject) to calculate
these forces. But they did'n't work if the velocity is too low. So when the
user push a direction I want to apply a specific velocity to my box. So I do
this:
if (velocity < 1.0f)
{
dVector3 v;
float temp_vitesse;
float temp_ecart;
float percentage;
dBodyGetRelPointVel (this->body,0,0,0,v);
temp_vitesse = sqrtf(NyoSqrf(v[0]) + NyoSqrf(v[1]) + NyoSqrf(v[2]));
if (temp_vitesse != 0.000f)
{
t emp_ecart = 1.1f - temp_vitesse;
percentage = temp_ecart / temp_vitesse;
v[0] = v[0] + v[0] * percentage;
v[1] = v[1] + v[1] * percentage;
v[2] = v[2] + v[2] * percentage;
}
dBodySetLinearVel(this->body,v[0],v[1],v[2]);
}
so after this code I have my body velocity at 1.1 -> no problem
but when I apply forces to the next loops, this velocity don't move and stay
at 1.1. However my forces are and more important.
I don't understand why my velocity doesn't increase.
Please help me
Arnaud
P.S: sorry for muy bad english
More information about the ODE
mailing list