Hey,
I've run into a problem which I am sure must have a simple solution. All I am trying to do is draw two squares, both set to the same position and one rotated by a set amount around the centre of the squares. However, I cannot get my head around how origins work in relation to rotation and positioning.
No matter what I try to do, the origin is set before both the positioning and rotation, which means that the rotation is always relative to the top left corner of the square. What I want to be able to do is position the two squares, then set a new origin just for the rotation - is this possible? If not then I cannot see how I can accurately place the two squares without using some horrible trigonometry.
Here's some example code:
rect2.Origin = new Vector2(20, 20);
rect2.Position = new Vector2(300, 300);
rect2.Rotation = 45;
gives the same result as
rect2.Position = new Vector2(300, 300);
rect2.Origin = new Vector2(20, 20);
rect2.Rotation = 45;
How do I draw a square at 0,0 rotated 45 degrees around its centre?
Thanks in advance,
Wibbs