Jump to content
  • Advertisement
Sign in to follow this  
Crazyfool

Rotations with ID3DXSPRITE [FIXED]

This topic is 3564 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I currently use the code below to rotate my projectiles:
D3DXMATRIX matRotate;
D3DXVECTOR2 vPosition(position.x, position.y);

D3DXMatrixTransformation2D(&matRotate, NULL, NULL, NULL, &vCenter, iter->angle, &vPosition);
d3dspt->SetTransform(&matRotate);


where vCenter is a vector of the center of the texture (16,16 for a 32 by 32 image) and vPosition is the position I want the the texture to be drawn in screen space. This is working perfectly fine until I moved to an animated texture. I now have a 512x256 texture that has multiple frames and will be rotated correctly (direction wise) but will not start or finish in the expected position. For instance, firing with an arrow that is a simple 32x32 texture will start at the character's chest no matter which angle it is fired at. However, the start position for the art effect starts in many different positions depending on the angle. This is extremely frustrating and I believe it has to do with rotating a texture where only a portion of it will be rendered. I tried increasing the image to 512x512 and setting the center to (256,256) but that seems to amplify the disparity in expected position and actual position. Any ideas on how to fix this are very appreciated. Thanks for your time! EDIT: This has been fixed. For those of you wanting to know what I did - I changed the center to be at 64,64, which is the middle of an individual frame. So, to sum it up - put the center in the center of whatever you will render! [Edited by - Crazyfool on December 21, 2008 1:27:43 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!