Jump to content
  • Advertisement
Sign in to follow this  
HanSoL0

Super quick D3DXSprite rotation question

This topic is 5411 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

Was wondering if anyone knows if it's possible to rotate a D3DXSprite around a point that is outside of the area of the sprite? For instance, can I rotate around point D3DXVECTOR2(100, 100) when the sprite bitmap is only 64x64 and scaled at D3DXVECTOR2(1, 1)? Thanks,

Share this post


Link to post
Share on other sites
Advertisement
I have actually used ID3DXSprite myself before, but I have done my own sprite drawing in DX9 (which I'm sure uses the same basic concepts as ID3DXSprite), and since no one else has answered, I'll venture to say that it almost definitely does support rotation around a point outside of the sprite. Due to the way sprites are drawn using 3D hardware, there is absolutely no difference in math between rotating around a point inside and a point outside of the sprite. I can't think of any reason why it wouldn't work.

Are you trying to plan ahead and make sure that you're not going to run into any major dead-ends before starting a project? Or do you already have a program up and running drawing sprites? If the latter, then why don't you simply try rotating about a point outside of the sprite and see what happens? Experimentation is a great way to learn.

Share this post


Link to post
Share on other sites
Well, this is the project I'm working on, and I'm implimenting a new HUD animation system. I tried rotating the sprite around a point outside of itself, and the sprite didn't render at all. :[ Just wondering if there's something I can do to jimmy-rig it. I'd rather not go through all the hassle of rotating the sprite around it's center, and then calculating the position in a circle it's supposed to go to fake the appearance of it rotating around an outside point.

Share this post


Link to post
Share on other sites
unfortunately Im on dialup so I cant open your movie. But Can u show us the code?
My guess is your rotation center is not correct. If you are just rotating on a 2D system (i.e. your UI layer) you can use one of the helper D3DX:

D3DXMatrixTransformation2D()
D3DXMatrixAffineTransformation()

Which should allow you to specify a rotation center. Alternatively, you can simply build a rotation matrix, then in the Draw call you can specify a center (this seems to work best, especially if you're drawing 3D sprites as well).

Quote:

there is absolutely no difference in math between rotating around a point inside and a point outside of the sprite. I can't think of any reason why it wouldn't work.


I too dont see why you wouldnt be able to rotate about any arbitrary point, my guess is that your program logic is at fault.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!