Skip to content

Instantly share code, notes, and snippets.

@kim366
Created October 20, 2016 18:07
Show Gist options
  • Save kim366/c859d818edbe9aa45b4dfbdfa311e2f9 to your computer and use it in GitHub Desktop.
Save kim366/c859d818edbe9aa45b4dfbdfa311e2f9 to your computer and use it in GitHub Desktop.
Rotate Player so he looks towards the cursor
sf::Vector2f delta(sf::Vector2f(sf::Mouse::getPosition(window)) - player.getPosition());
player.setRotation(atan(delta.y / delta.x) * 180 / PI);
@kim366
Copy link
Author

kim366 commented Oct 20, 2016

mousetocursor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment