I am looking for a way to move my scene so that when I translate forward/back/left right it moves directly up/down/left/right on the screen. Currently it does do that until I rotate (by anything other than 360...). After rotation the up/down/left/right moves in the direction of the rotation. I need it to move directly up/down/left/right on screen. I've been racking my brains trying all kinds of different matrix rotations and multiplication but I can't get it. MOST IMPORTANTLY - I need it to maintain a single rotation axis of 0,0,0 so the centre of rotation is always near the middle of the screen regardless of how far I scroll. I can easily rotate on the centre of the scene itself and have it translate how I want (translate to co-ord, rotate, translate back, go to position) but I need that axis to remain fixed. Otherwise the centre of rotation could be somewhere way off-screen.
Fig 1. Shows the starting position of the model(scene). Fig 2. The modelview is rotated 45deg. Fig 3. Decrementing the z-value causes the model to move out along z - which I do not want. Fig 4 I need the model to move straight back (between z and x).
I have tried using sin / cos rule in an attempt to translate the vertices back along the arc between the undesired position (Fig 3) and the desired one (Fig 4) but the math is off and the process is messy. I just know there has to be a clean/simple solution out there. I am coding this in Java (JOGL) and passing modelview and projection matrices to a vertex shader. Also, I am not using deprecated functions (no begin/end/glRotate etc).
Does anyone know of a matrix multiplication that will accomplish this?