I have just two local axis to rotate a 3D object: X (horizontal) and Y (vertical). How to make from this 2 local axises for example a global Y rotation or a Local Z rotation? What math magic do the trick?
If you know how to make a rotation matrix from X,Y,Z basis vectors (just make them the rows or columns, depending on whether you are using a row or column major matrix), you can do that, using the cross product of X and Y to get the Z vector.
The order of X and Y in the cross product depend on whether you are using a left or right handed coordinate system, but if you are unsure about this, you can check if doing Z=cross(X,Y) looks right and if not, switch to Z=cross(Y,X).
So, it'll be something like this:
// May be Y,X instead, depending on your handedness Z = Cross(X,Y); // May need to be transposed based on you using row or column major matrices RotationMatrix = MatrixFromRows(X,Y,Z);