Created
October 20, 2016 18:07
-
-
Save kim366/c859d818edbe9aa45b4dfbdfa311e2f9 to your computer and use it in GitHub Desktop.
Rotate Player so he looks towards the cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sf::Vector2f delta(sf::Vector2f(sf::Mouse::getPosition(window)) - player.getPosition()); | |
player.setRotation(atan(delta.y / delta.x) * 180 / PI); |
Author
kim366
commented
Oct 20, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment