- #1

Artlav

- 162

- 0

Specifically, the horizon frame is y for up, z for north, x for east, the plane frame is x for right wing-wards, z for nose-wards, y for up. I know unit vectors of plane frame in horizon frame, and want to find out bank angle from them.

The best attempt yet is:

npr=normalize(z_horizon.x,0,z_horizon.z);

rh=normalize(y_horizon-(npr*scalar(npr,y_horizon)));

bank=sign(x_horizon.y)*atan2(sqrt(sqr(rh.x)+sqr(rh.z)),rh.y);

Basically, trying to subtract the projection of the up onto the forward from the up and compute the angle to horizon plane, but it does not work right if pitched and banked.

Any help?