Hi folks, I have to create a game for 6 players on a touch screen table. So I have to rotate the viewports (for each player a individual viewport) around the display. For this task I use this script on each camera: Code (csharp): using UnityEngine; using System.Collections; public class CameraMatrixManipulator : MonoBehaviour { public float ViewportAngle = 0f; public Vector3 Scale = Vector3.one; void Start(){ } void OnPreCull() { camera.ResetWorldToCameraMatrix(); camera.ResetProjectionMatrix(); camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.TRS(camera.transform.position, Quaternion.AngleAxis(ViewportAngle, camera.transform.forward), Scale); } void OnPreRender() { GL.SetRevertBackfacing(true); } void OnPostRender() { GL.SetRevertBackfacing(false); } } Everything seems fine but when I move the rotated (ViewportAngle = -90 for e.g.) cameras during runtime on the x OR y individually axes the viewport shifts on x AND y the same time. I hope one of you can show me a hint what is wrong in my script. Thank you really much! Regards [SOLVED] I set the viewport rect of each camera, rotated each camera and then each camera got a empty GameObject without rotation. Thats the Solution. It's so easy... Damn it.
no response... so newbie question time bit of a shot in the dark but it's not an issue of World vs Local coordinate systems is it?
This is a good idea, but I don't know where. This problem only happens when the ViewportAngle is unequal 0. Any other ideas?
Another idea was to use this method, but it doesn't work, too. Code (csharp): camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.TRS(camera.transform.position, Quaternion.Euler(0, 0, ViewportAngle), Scale);