I'm working with ODE and everything works fine. I have an biplane which flies, lands, takes off, etc. But there is a problem when it flies towards the earth (perpendicularly). Here is my code:
if(key_w) {
if (m2 <= 5000){m2 += 30;}}
if(m2 >= 4000){ f =8879;}
if (m2 < 4000){ f = 0;
}
phent_addcentralforce (my, vector(0,0, f), nullvector);
if(key_q)
{
phent_addtorquelocal (my, vector(-30,0,0) );
}
if(key_e)
{
phent_addtorquelocal (my, vector(30,0,0) );
}
if (key_s){m2 -= 20;
}
if(key_w == 0)
{
if(m2 > 0){m2 -= 5;}
}
phent_addforcelocal ( my, vector(m2,0,0),nullvector);
where m2 is force applied (thrust), which increases with time.... g is gravity = -386.... adn f is lift force f = 8879, since the mass of the plane is 23. When I fly horizontally wverything is ok, but when i fly towards the ground the plane flies backwards away from the ground if "w" is pressed, instead of flying faster since also gravity force acts on it.
I tried to write addvellocal instead of addforcelocal, but now the plane flies forward if "w" is pressed, but does not fall on the ground (when directed towards it) if "w" is not pressed, though there is gravity acting on t.....
Does anyone know what can be the problem?? and why it behaves so weirdly?