What are the correct camera (quaternion) transformations to change the object view

80 Views Asked by At

I'm currently working with some camera rotations. The issue is, given a camera in an arbitrary rotation (R) and position (T) in a three dimensional space I want to give the viewer the impression that they are able to rotate any item centred at (0,0,0) by an angle alpha.

This is an example of an arbitrary camera:

enter image description here

While this is the effect I would like to obtain (car facing forward, rotated by alpha=90º):

enter image description here

However I would like this effect to be obtained by means of moving the camera only, NOT the car:

enter image description here

In summary, (A) is the arbitrary camera, in (B) the object is rotated and in (C) the same effect is achieved rotating the camera only.

enter image description here

The camera position is a three dimensional vector containing the XYZ values while the rotation is represented with a Quaternion. What series of transformations should I apply to the camera to achieve this result ?

Thanks in advance