Sign in to follow this  

Understanding sprites please...

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

OK, I've done some searches for sprites and how to understand them, but my attemps have returned nothing. I made a post earlier on how to create cloud effects and was directed to a link on using sprites. I understand the begin and end portion. I'm stuck now on which draw method to use? Draw or Draw2D. Does anybody know what the difference is and could you explain what they are and what they do? Thanks, -Devin P.S. It's my beleif that the transform matrix property of the sprite is used for spatial placement within the scene, is this correct? [edit] Does it just seem to me or are others wondering why Microsoft has lef their DirectX documentation relatively undocumented? [Edited by - devronious on December 17, 2005 10:16:23 AM]

Share this post


Link to post
Share on other sites
Sprite.Draw2D was an easy method that converted your point sprites to Vector3's. Microsoft also recommends that you move from Sprite.Draw2D to Sprite.Draw().
So from my side, use Sprite.Draw, as Sprite.Draw2D was just a convenience method added to the API that did this conversion for you.

I hope this helps.
Take care.

Share this post


Link to post
Share on other sites
Thanks, I'm having a little trouble positioning the sprite. I noticed that the vector arguments for the draw method are in screen coordinates. So 0,0,0 is the top left and for a 640x480 viewport 640,480 would be the lower right.

I assume that you have to take a world coordinate and convert it to a screen coordinate. I tried Vector3.Project method and it seems to be acting funny. Like it only changes the coordinate by + or - 0.5 units from world to screen. So if a plug in 500,500,500. and I project it I end up with 500.5,500,500.5 as an example. Is there something I'm missing?

Thanks for your help,

Devin

Share this post


Link to post
Share on other sites
For those that might be interested I figured it out. the Sprite.Begin method call sets the view matrix to identity. So if your projecting a vector3 using the Vector3.Porject method and you grab the view matrix from the current device it will not be the correct view matrix. You must store a copy of it before the call to Sprite.Begin.

Share this post


Link to post
Share on other sites

This topic is 4382 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this