I am working on Context-aware camera in Unity. in this project i have to set parameters of the camera each frame manually depending on what camera sees on the screen. New View (v) direction is given and Up (u) and Right (r) vectors should be such that they minimize torsion with previous frame's u and r. I have deployed the following code to accomplish the given task:
Vector3 viewNew = -m_Normal;
Vector3upNew=Vector3.Cross(viewNew,m_CameraPrevTransform.right).normalized;
Vector3 rightNew = Vector3.Cross(viewNew, upNew).normalized;
...
transform.forward = viewNew;
transform.up = upNew;
transform.right = rightNew;
The problem is: it seems like Unity tries to automatically adjust parameters when one of the directions (up, forward, right ) are set. Is there a workaround ? is it possible to get more control of the camera?
transform.rotation = Quaternion.LookRotation(viewNew, upNew);\$\endgroup\$