float elapsed = 0f; while (elapsed < shakeDuration) Vector3 randomOffset = Random.insideUnitSphere * shakeMagnitude; transform.localPosition = originalPos + randomOffset;
IEnumerator DoShake()
private Vector3 originalPos; private Quaternion originalRot; private float shakeDuration = 0f; private float shakeMagnitude = 0.1f;
void Start()
using UnityEngine; using System.Collections; public class UniCameraShake : MonoBehaviour
float elapsed = 0f; while (elapsed < shakeDuration) Vector3 randomOffset = Random.insideUnitSphere * shakeMagnitude; transform.localPosition = originalPos + randomOffset;
IEnumerator DoShake()
private Vector3 originalPos; private Quaternion originalRot; private float shakeDuration = 0f; private float shakeMagnitude = 0.1f; uni.camera shake
void Start()
using UnityEngine; using System.Collections; public class UniCameraShake : MonoBehaviour float elapsed = 0f; while (elapsed < shakeDuration)
The uploaded content will be moved to this newly created album. You must create an account or sign in if you want to edit this album later on. float elapsed = 0f