Skip to content

Instantly share code, notes, and snippets.

@Henry-E
Last active August 29, 2015 14:22
Show Gist options
  • Save Henry-E/6fec2faed1ebe696ae9f to your computer and use it in GitHub Desktop.
Save Henry-E/6fec2faed1ebe696ae9f to your computer and use it in GitHub Desktop.
// outside of the class, below "Using UnityEngine"
using Random = UnityEngine.Random;
// make sure to initialise this properly
fudgeFactor = 30;
// inside the update function
atan2 = Mathf.Atan2 (v_diff.y, v_diff.x);
Quaternion newAngle = Quaternion.Euler (0f, 0f, atan2 * Mathf.Rad2Deg + Random.Range( - fudgeFactor, fudgeFactor) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment