All is in the title but for more info :
If you want to rotate a sprite, it’s easy, you use the method :
SpriteBatch.Draw (Texture2D, Vector2, Nullable, Color, Single, Vector2, Single, SpriteEffects, Single)
Here single accept a radian to apply a rotation.
That’s neat.
And on the over hand, if you want to rotate a Rectangle, you have to use the Transfrom() method (that i don’t totally understand because documentation about this is bad) you will need to create every corner of the Rectangle you want to rotate and manage them. I guess this can add huge work depending on what you want to achieve.
For my game, i would like to apply rotation in my Update() instead of my draw to detect specific collision between rectangles with my logic code.
I tried to use :
`vector2_of_my_rect = new Vector2(100, 100);
my_rect = new Rectangle(vector2_of_my_rect.X, vector2_of_my_rect.Y, 20, 200);
my_radian = 0.5f;
vector2_of_my_rect = Vector2.Transform(vector2_of_my_rect , Matrix.CreateRotationX(my_radian);`
I choose this use of the method Transform() because it looked like simple and seemed to don’t require to create each corner of my rectangle.
but when i use it, vector2_of_my_rect stay straight and don’t rotate at all.
I’m lost.