16
Graphics / Re: is it possible to rotate a line?
« on: January 17, 2020, 09:00:15 am »Rotating is usually done like this:x = center.x + radius * cos(angle);
y = center.y + radius * sin(angle);
// switch +- or sin/cos depending on your axes directions and where you want 0° to be
Or you can use a properly configured sf::Transform that you pass when drawing the vertices.
@Laurent, thanks so much this did it. I incremented the angle by += 0.1 for a slow effect for cos(angle) and sin(angle) and it's spinning. Just out of curiosity, how can I use sf::Transform properly to pass through vertices? I was having trouble with transform and lines.