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

Apr 23, 2013 at 9: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" (http://0.tqn.com/d/rubberstamping/1/0/E/D/-/-/purple1.jpg) 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 23, 2013 at 11:03 PM
Please show us what code you are using to draw the sprite, and what result you get.
Apr 24, 2013 at 4:19 AM
Edited Apr 24, 2013 at 4: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 2:38 PM
Yay! Glad to hear you figured it out.
Marked as answer by walbourn on 1/23/2014 at 11:28 PM