-
-
Save insominx/f3acce17108d0a2e4619 to your computer and use it in GitHub Desktop.
Revisions
-
insominx revised this gist
Jan 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,7 @@ IEnumerator Shake() { float percentComplete = elapsed / duration; float damper = 1.0f - Mathf.Clamp(4.0f * percentComplete - 3.0f, 0.0f, 1.0f); // map value to [-1, 1] float x = Random.value * 2.0f - 1.0f; float y = Random.value * 2.0f - 1.0f; x *= magnitude * damper; -
insominx created this gist
May 16, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ IEnumerator Shake() { float elapsed = 0.0f; Vector3 originalCamPos = Camera.main.transform.position; while (elapsed < duration) { elapsed += Time.deltaTime; float percentComplete = elapsed / duration; float damper = 1.0f - Mathf.Clamp(4.0f * percentComplete - 3.0f, 0.0f, 1.0f); // map noise to [-1, 1] float x = Random.value * 2.0f - 1.0f; float y = Random.value * 2.0f - 1.0f; x *= magnitude * damper; y *= magnitude * damper; Camera.main.transform.position = new Vector3(x, y, originalCamPos.z); yield return null; } Camera.main.transform.position = originalCamPos; }