InvertCamera

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Removing all content from page)
m (Reverted edits by Joseph05408 (Talk); changed back to last version by Joeante)
Line 1: Line 1:
 +
[[Category: Camera]]
 +
[[Category: MonoBehaviour]]
 +
[[Category: JavaScript]]
 +
Author: (Joachim Ante)
 +
==Description==
 +
This script inverts the view of the camera. So everything rendered by the camera is flipped.
  
 +
==Usage==
 +
Attach the script to a camera.
 +
 +
==JavaScript - InvertCamera.js==
 +
<javascript>
 +
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)
 +
</javascript>

Revision as of 19:06, 19 October 2009

Author: (Joachim Ante)

Description

This script inverts the view of the camera. So everything rendered by the camera is flipped.

Usage

Attach the script to a camera.

JavaScript - InvertCamera.js

<javascript> 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) </javascript>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox