This project has moved and is read-only. For the latest updates, please go here.

[Request] Sample with Sprite Rotation About Sprite's Own Center

Apr 23, 2013 at 10:05 PM

I have been trying to rotate a sprite about it's own center using the SpriteBatch::Draw method and the correct origin. However, the sprite rotates on about another center point, and drawing sprites rotated a different angles forms a "pinwheel" ( in which the center of the wheel would be the origin the sprites rotate around, rather than their own, center origin that I calculated using XMFLOAT2 origin(spriteWidth/2.0f, spriteHeight/2.0f)

Can you please provide a quick sample or point me in the right direction.

  • Chev
Apr 24, 2013 at 12:03 AM
Please show us what code you are using to draw the sprite, and what result you get.
Apr 24, 2013 at 5:19 AM
Edited Apr 24, 2013 at 5:20 AM
Hi Shawn,

Please, close this request. Seems I kept overlooking the fact that I was using the scaled width and height as means to set the origin, instead of the actual width and height of the texture itself. I was probably staring at the screen too long. Just went back to take you screenshots and noticed it right away.

  • Chev
Apr 24, 2013 at 3:38 PM
Yay! Glad to hear you figured it out.
Marked as answer by walbourn on 1/23/2014 at 11:28 PM