Mirror flip camera?

hi
I found this script on the Wiki called InvertCamera

// EXAMPLE WITH CAMERA UPSIDEDOWN
function OnPreCull () {
	camera.ResetWorldToCameraMatrix ();
	camera.ResetProjectionMatrix ();
	camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(Vector3 (1, -1, 1));
}
 
function OnPreRender () {
	GL.SetRevertBackfacing (true);
}
 
function OnPostRender () {
	GL.SetRevertBackfacing (false);
}
 
@script RequireComponent (Camera)

“This script inverts the view of the camera. So everything rendered by the camera is flipped. This will help you to implement a rear mirror camera.”

It makes every think look up side down basically.
But I’m trying to make it get flipped vertical. will this even be possible?

Just change the matrix (line 5 of your code) to flip the x axis instead of the y axis:

  camera.projectionMatrix = camera.projectionMatrix * Matrix4x4.Scale(Vector3 (-1, 1, 1));

For the next coming on this post.
C# version of it.
(Tested in 2019.1.14f )

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlipCamera : MonoBehaviour
{

    public Camera m_camera;
    void OnPreCull()
    {
        m_camera.ResetWorldToCameraMatrix();
        m_camera.ResetProjectionMatrix();
        m_camera.projectionMatrix = m_camera.projectionMatrix * Matrix4x4.Scale(new Vector3(-1, 1, 1));
    }

    void OnPreRender()
    {
        GL.SetRevertBackfacing(true);
    }

    void OnPostRender()
    {
        GL.SetRevertBackfacing(false);
    }
    
}

the above approach messes up with occlusion culling so here’s an approach that worked for me:
copy paste the main camera, flip it, then enable it and disable the other at runtime on that button down, and reinitialize the camera. On the standard assets RigidBodyFirstPersonController this is mouseLook.Init (transform, cam.transform);

Or just rotate the camera 180 degrees on the Z axis.