Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@drhayes
Last active August 27, 2018 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drhayes/271eb22b098ba6d19bc298526ecd1f2a to your computer and use it in GitHub Desktop.
Save drhayes/271eb22b098ba6d19bc298526ecd1f2a to your computer and use it in GitHub Desktop.
Slerp between rotations without doing the flippy thing.
local ax, ay = math.cos(fov.angle), math.sin(fov.angle)
local gx, gy = math.cos(goalAngle), math.sin(goalAngle)
ax, ay = ax + gx * 5 * dt, ay + gy * 5 * dt
fov.angle = math.atan2(ay, ax)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment