XNA Sprite Rotation Matrix - Moving Origin
- by Jon
I am currently grouping sprites together, then applying a rotation transformation on draw:
private void UpdateMatrix(ref Vector2 origin, float radians)
{
Vector3 matrixorigin = new Vector3(origin, 0);
_rotationMatrix = Matrix.CreateTranslation(-matrixorigin) * Matrix.CreateRotationZ(radians) * Matrix.CreateTranslation(matrixorigin);
}
Where the origin is the Centermost point of my group of sprites. I apply this transformation to each sprite in the group.
My problem is that when I adjust the point of origin, my entire sprite group will re-position itself on screen.
How could I differentiate the point of rotation used in the transformation, from the position of the sprite group? Is there a better way of creating this transformation matrix?