An old post of mine:

Quote:

If the hovering vehicle is close to the ground it adapts its orientation to the slope, otherwise it normalizes its rotation.

if(c_trace(my.x,vector(my.x,my.y,my.z-150),IGNORE_ME | IGNORE_PASSABLE)) {
vec_rotate(normal,vector(-my.pan,0,0));
my.tilt = -asin(normal.x);
my.roll = -asin(normal.y);
}
else {
my.tilt += -my.tilt/5*time;
my.roll += -my.roll/5*time;
}



"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends