For a bit of background: I'm working on a tech demo for the Gameboy Advance, where I'm using pre-rendered backgrounds - combined with a 3D navmesh, and a camera matrix - to place actors into the scene. Because the GBA doesn't have any 3D hardware, my plan is to pre-render the actors from many different angles (eg. 8 angles around the global up/down axis, and 4 angles around the global left/right axis), and then choosing the correct angles for display. Note that rotation about the camera z axis doesn't need pre-rendering, as I can do this using the GBA hardware directly, provided that this is the last rotation (all I need is the sine/cosine terms).
And now for the part I'm stuck on: If you are given the camera matrix (which in my case consists of an orthogonal 3x3 view matrix, plus a translation vector and FOV + viewport scaling factor), how do you deduce which angles to use for displaying the actor?
For example: if my actor sprite sheets are arranged as an array like [GlobalRotX=0..3][GlobalRotY=0..7], and the final rotation about the camera z axis accepts an angle theta, then given the actor position pos_char.xyz and local rotation rot_char.xyz, how do I calculate GlobalRotX, GlobalRotY, and theta? To make things easier to explain, you can just assume that GlobalRotX/Y and theta are all in the range -Pi..+Pi or whatever - I just need to be able to understand the maths behind this, rather than bogging things down with implementation details.
My first thought had been to find the camera position in world space (by multiplying the negated translation vector by the inverse/transpose of the 3x3 view matrix), then somehow use an atan2 with the camera position and the actor position, but this feels wrong and incomplete. For example, if the camera has a rotation about the forwards/backwards axis, this wouldn't be taken into account, I think.
Any help would be greatly appreciated. I've tried searching a fair bit, but everything I've found involving angle extractions seems to assume that you are generating sequential transformations from that information (which is most definitely not what I'm doing), and I'm just not that good at this kind of maths to be able to unravel what is actually going on in there.