XNA Sprite Clipping Incorrectly During Rotation

Posted by user1226947 on Game Development See other posts from Game Development or by user1226947
Published on 2012-11-26T13:16:06Z Indexed on 2012/11/26 17:28 UTC
Read the original article Hit count: 243

Filed under:
|
|
|
|

I'm having a bit of trouble getting my sprites in XNA to draw.

Seemingly if you use SpriteBatch to draw then XNA will not draw it if for example (mPosition.X + mSpriteTexture.Width < 0) as it assumes it is offscreen.

However, it seems to make this decision before it applies a rotation. This rotation can mean that even though (mPosition.X + mSpriteTexture.Width < 0), some of the sprite is still visible on screen.

My question is, is there a way to get it to draw further outside the viewport or temporarily disable sprite clipping during a certain spriteBatch.draw(...)?

sb.Draw(mSpriteTexture, mPosition,
                new Rectangle(0, 0, mSpriteTexture.Width, mSpriteTexture.Height),
                Color.White, Globals.VectorToAngle(mOrientation), new      Vector2(halfWidth, halfHeight), scale, SpriteEffects.None, 0);

© Game Development or respective owner

Related posts about XNA

Related posts about c#