Created
October 3, 2016 19:30
-
-
Save nathanwentworth/6a53de22e04ebe83c15e0b92479cf382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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