Hi I'm a bit stuck on how I can track a point on a sprite after rotation is applied.
Let's say I have a point that I've saved away that I want my bullets to spawn at, typically the end of a rifle for an example. But after I execute the rotation code:
sf::Vector2f curPos = GetSprite().getPosition();
sf::Vector2i position = sf::Mouse::getPosition(window) ;
const float PI = 3.14159265;
float dX = curPos.x - position.x;
float dY = curPos.y - position.y;
rotation = (atan2(dY, dX)) * 180 / PI;
GetSprite().setRotation(rotation - 90);
I want that point X to stay with the sprite so I can use it as an anchor for my bullets. I know there's and formula for it somewhere but I have not yet found it. Can anyone point me in the right direction?