Skip to content

Instantly share code, notes, and snippets.

@sylvia43
Last active August 29, 2015 14:03
Show Gist options
  • Save sylvia43/cbd1fc3c53ffff588187 to your computer and use it in GitHub Desktop.
Save sylvia43/cbd1fc3c53ffff588187 to your computer and use it in GitHub Desktop.
Update an objects location using polar coordinates.
// cx: X position of object to rotate around.
// cy: Y position of object to rotate around.
// theta: Angle to be from object, 0 is right, CCW.
// r: Distance from object to rotate around.
x = cos(degtorad(theta))*r + cx;
y = sin(degtorad(theta))*r + cy;
// Usage:
// Jump to this point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment