Uni.camera Shake [hot] -

Vector3 randomRot = Random.insideUnitSphere * shakeMagnitude; transform.localRotation = originalRot * Quaternion.Euler(randomRot);

float elapsed = 0f; while (elapsed < shakeDuration) Vector3 randomOffset = Random.insideUnitSphere * shakeMagnitude; transform.localPosition = originalPos + randomOffset;

using UnityEngine; using System.Collections; public class UniCameraShake : MonoBehaviour uni.camera shake

private Vector3 originalPos; private Quaternion originalRot; private float shakeDuration = 0f; private float shakeMagnitude = 0.1f;

shakeDuration = duration; shakeMagnitude = magnitude; StartCoroutine(DoShake()); Vector3 randomRot = Random

elapsed += Time.deltaTime; yield return null; transform.localPosition = originalPos; transform.localRotation = originalRot;

IEnumerator DoShake()

void Start()