Original Post
Here is my current WorldMatrix function
When changing the radians for the rotation_ my sprite does rotate but around the bottom left of the screen.
I was guessing that I would need to use XMMatrixRotationNormal() to get the results I want but through experimentation I still come up with the same results.
For example I tried
Could anyone tell me how to move the origin for the z-axis to the center of my sprite?
XMMATRIX GameSprite::GetWorldMatrix( )
{
//position is the pixel position of the sprite on screen
XMMATRIX translation = XMMatrixTranslation( position_.x, position_.y, 0.0f );
XMMATRIX rotationZ = XMMatrixRotationZ(rotation_ );
XMMATRIX scale = XMMatrixScaling( scale_.x, scale_.y, 1.0f );
return translation * rotationZ * scale;
}
When changing the radians for the rotation_ my sprite does rotate but around the bottom left of the screen.
I was guessing that I would need to use XMMatrixRotationNormal() to get the results I want but through experimentation I still come up with the same results.
For example I tried
XMMATRIX rotationZ = XMMatrixRotationNormal(tempvector, rotation_ );
//with defiintions like these
XMVECTOR tempvector = {0.0f, 0.0f, 1.0f};//Same as RotationZ()
XMVECTOR tempvector = {position_.y, position_.x, 1.0f};//Wierd results
Could anyone tell me how to move the origin for the z-axis to the center of my sprite?