Thursday, April 24, 2014

Final Fixes Before the Show

After finally setting up I realized that I made a huge mistake with the Unity version that I didn't notice until after setting it up on the pyramid. I forgot that since the image reflects from the TV to the pyramid, the Leap Motions controls are technically reversed as well.

I fixed it within 30 minutes by writing this code:

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)

Basically flips the camera and uses backfacing to flip the image. A very easy and effective fix.

No comments:

Post a Comment