Skip to content

Instantly share code, notes, and snippets.

@TelpeNight
Created May 7, 2020 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TelpeNight/5264494eca24b8ad782e72a700a0fa44 to your computer and use it in GitHub Desktop.
Save TelpeNight/5264494eca24b8ad782e72a700a0fa44 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class FunkyProjectionMatrix : MonoBehaviour
{
public Matrix4x4 originalProjection;
Camera cam;
void Start()
{
cam = GetComponent<Camera>();
originalProjection = cam.projectionMatrix;
}
void Update()
{
Matrix4x4 p = originalProjection;
p.m00 += Mathf.Sin(Time.time * 1.1F) * 0.1F;
p.m01 += Mathf.Sin(Time.time * 1.2F) * 0.1F;
p.m02 += Mathf.Sin(Time.time * 1.3F) * 0.1F;
p.m03 += Mathf.Sin(Time.time * 1.4F) * 0.1F;
p.m10 += Mathf.Sin(Time.time * 1.5F) * 0.1F;
p.m11 += Mathf.Sin(Time.time * 1.6F) * 0.1F;
p.m12 += Mathf.Sin(Time.time * 1.7F) * 0.1F;
p.m13 += Mathf.Sin(Time.time * 1.8F) * 0.1F;
cam.projectionMatrix = p;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment