I'm trying to creat something like an autopilot for my vehicle. It's basicly a hovercraft, that is lifted off the ground by adding a local z-velocity. Much like a helicopter. The player can normaly control that amount, to adjust the altitude. Now alternativly, that amount should be automaticly controled so that the vehicle stays at it's present altitude.
I've tried setting the z-velocity to the amount of the gravity [ph_setgravity (vector(0, 0, -500))], but thats way to much, the vehicle goes up like a rocket.
Then I tried to find an amount by slowly adding velocity, but that turned out to be harder than I thought, because it's dependent on the framerate!
Is gravity dependent on the framerate, too?
Is there a way to calculate the amount of acceleration at the moment and then use it to counter it?
After trying for a long time I got everything messed up, but maybe it's a simple task for some of you.
Thx for you Help!
so long...
phent_settype(my, PH_RIGID, PH_BOX);
phent_setmass(my, 500, PH_BOX);
phent_setfriction(my, 5);
phent_setdamping(my, 75,100);
phent_setelasticity(my, 10, 40);
ph_setgravity (vector(0, 0, -500))