I'm making a photo booth which lets me store a number of camera positions via a HUD and switch between them.
Once I have positioned the camera and 'lock' it, I store the camera position and rotation so I can put the camera back to the exact same location and rotation later, re-calculating the Focus. So far, so good...
However, if the booth is moved or rotated, (or both), then the stored camera position and rotation are still pointing to the old target. Obviously I need to store the camera pos and rot relative to the pos and rot of the booth... but I can't get my head around whether the rotation is applied to the camera position before or after I store it.
To fix this with respect to the position, I store the cam positions as X/Y/Z 'offsets' from the root prim's centre and store the cam's rotation 'as is', but although this works great if I move the booth, it doesn't work when I try to restore the camera if the booth has been rotated. Obviously the rotation of the booth has to be applied to the stored camera position and/or rotation. So far, neither works either multiplying or dividing the cam position by the booth's rotation...
Should I even be storing the cam position as an offset from the root centre? Using this method does work if the booth is moved... but not when it is rotated.
Do I have to take the booth's rotation into acount when storing the position of the camera as opposed to the cam's rotation... or both?
To be honest, I'm confused at the moment so I may well be over-complicating things...
In a nutshell... I want to position the camera looking zoomed in at say the head of someone sitting in the booth, store the camera data, then move and rotate the booth and still be able to put the cam back to give me the exact zoomed view.
Many thanks in advance for any pointers - I don't mind figuring things out for myself, so specific code not required.