InvertCamera

From Unify Community Wiki
Jump to: navigation, search

Author: (Joachim Ante)

Description

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.

Usage

Attach the script to a camera.

JavaScript - InvertCamera.js

// 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)
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox