I can't manage to rotate point around another point.
I did some searching around google and found algorithm that should work and it kinda does but it also moves the point I am rotating closer to pivot point.
Here is whole class where the problem is
public class Player {
float rotation;
Vector2 position;
Vector2 center;
public Player() {
position = new Vector2(Core.WIDTH / 2 - 10, Core.HEIGHT - 50 - 10);
center = new Vector2(Core.WIDTH / 2, Core.HEIGHT / 2);
rotation = 0;
}
public void turnRight() {
rotation += 0.001;
position.x = (float) (Math.cos(rotation) * (position.x - center.x) - Math.sin(rotation) * (position.y - center.y) + center.x);
position.y = (float) (Math.sin(rotation) * (position.x - center.x) + Math.cos(rotation) * (position.y - center.y) + center.y);
}
public void render(ShapeRenderer sr) {
sr.circle(position.x, position.y, 20);
}
}
