Skip to content

Instantly share code, notes, and snippets.

@almyu
almyu / ShakeRoutine.cs
Last active February 9, 2017 11:11 — forked from GeorgiyRyaposov/ShakeRoutine.cs
Shake routine
public Vector3 shakePower = new Vector3(0.03f, 0.03f, 0.03f);
public float shakeDuration = 1f;
private IEnumerator ShakeRoutine()
{
for (var t = 0f; t < shakeDuration; t += Time.unscaledDeltaTime)
{
var offset = transform.rotation * Vector3.Scale(Random.onUnitSphere, shakePower);
transform.position += offset;