Skip to content

Instantly share code, notes, and snippets.

@dennda
Created September 8, 2011 20:54
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 dennda/1204675 to your computer and use it in GitHub Desktop.
Save dennda/1204675 to your computer and use it in GitHub Desktop.
{
float rotstep = ((M_PI / 2.) / 9.) / 2.;
GLKVector2 ndir = GLKVector2Normalize(direction);
_rx += ndir.y * rotstep;
if (_rx > M_PI_2)
_rx = M_PI_2;
if (_rx < -M_PI_2)
_rx = -M_PI_2;
_ry += ndir.x * rotstep;
if (_ry > M_PI)
_ry -= 2 * M_PI;
if (_ry < -M_PI)
_ry += 2 * M_PI;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment