Unfortunately, none of the proposed solutions work for me. They seem to be good solutions and are likely to work in other scenarios, but not in my case.
However, I found a solution that works:
I changed the values ββfor the OffsetX and OffsetY fields of the matrix as follows:
OffsetX = OffsetX - M11 * hx - M21 * hy + hx;
OffsetY = OffsetY - M12 * hx - M11 * hy + hy;
Where hx is the half width, hy is half the height of the sprite, and M11, M12 and M21 are the corresponding fields of the matrix.
source
share