Drawing a Transformed Rectangle

Hi there.

I’m testing some pixel collision detection and I’ve obviously got a problem, but I’m not sure where it’s starting. I’m not going to paste in all the code as it’s getting pretty large, but the following is how I’m creating my matrix and rectangle on one of the sprites: (This is VB, the code for the other sprites is identical)

Dim lTransform As Matrix = Matrix.CreateTranslation(New Vector3(-l.Centre, 0)) * Matrix.CreateRotationZ(l.Rotation) * Matrix.CreateTranslation(New Vector3(l.Position, 0)) Dim lRectangle As Rectangle = BoundingBox(New Rectangle(0, 0, l.Width, l.Height), lTransform)

  1. I found a tutorial somewhere, (I can’t remember what it was) it described transforming the color data, but it didn’t have rotation in the equation, the above is the only way I could get rotation in and make it work at all, but is it correct?
  2. If I want to see what’s going on in the rectangle, how can I SpriteBatch.Draw the rectangle on the screen?

Thanks.