Skip to content

Instantly share code, notes, and snippets.

@nathanwentworth
Created October 3, 2016 19:30
Show Gist options
  • Save nathanwentworth/6a53de22e04ebe83c15e0b92479cf382 to your computer and use it in GitHub Desktop.
Save nathanwentworth/6a53de22e04ebe83c15e0b92479cf382 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class CameraNoise : MonoBehaviour
{
public Transform cam;
private float x1, y1, x2, y2;
public float noiseStrength = 5;
void Start()
{
x1 = y1 = x2 = y2 = 0f;
}
void FixedUpdate()
{
if (!cam) return;
cam.transform.localPosition = new Vector3(Mathf.PerlinNoise(x1 += .01f, y1 += .01f) * Time.deltaTime * noiseStrength, Mathf.PerlinNoise(x2 += .01f, y2 += .01f) * Time.deltaTime * noiseStrength, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment