Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xgkkp

Objects, confusion and Matrices.

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

I have a triangle in a vertex buffer, and it spins. However, I want to be able to move it around. Using matrices because i understand them, but the matrix stuff in dx seems to be very messy. If, say, I want to rotate an object, do I rotate it and then send it to drawprimitive, of so i rotate the whole world and then send it to drawprimitive. Also, how do I do this. I want to start laying stuff out. Using OpenGL i manages to work out after a few days of NeHe how to make a GTA like map, but there seems to be a lack of large amounts of Dx8 resources on the net. I am sorry if this post is confusing, but I am confused.

Share this post


Link to post
Share on other sites
Advertisement
The DirectX docs are pretty good, you just have to read over the confusing parts a few more times. Also, a search on the web into matrix math (the DX docs cover it anyway) will help if you''re stuck with that.

A good idea would be to use the ID3DXMatrixStack interface to imitate the OpenGL matrix stack functions.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites
Let me see if I can help...

In the case of rotating an object (say a triangle), your triangle should maintain its own world matrix that keeps track of the triangle''s transformations in world space. If you had six triangles, they would each have there own world matrix and you would set the appropriate matrix:

SetTransform( D3DTS_WORLD, &m_matWorld )

before calling DrawPrimitive on each. Of course you would update the triangle''s world matrix each frame if you wanted it to rotate smoothly.

Check out http://www.drunkenhyena.com/ or the numerous other sites with intro DirectX tutorials.

Share this post


Link to post
Share on other sites
Thanks! Its just wih OpenGL there arent several matrices (that I know). Is Changing the view matrix changing the camera position?

Share this post


Link to post
Share on other sites
As siaspete has told you, the SDK Docs explain all the matrix thing pretty well, so take a look first, then if you have any question come back here.

If I''m not wrong, MS recommends not using the matrix view and play only with the world view (or maybe I have dreamed it). As said, a look at the Docs will clarify things very much.

Share this post


Link to post
Share on other sites
Changing the view matrix is essentially changing the camera. The view matrix can be thought of as the position, lookAt, and upVector all thrown together into one matrix.

By using D3DXMatrixLookAtLH( ... ) you can set all of these properties with one call. Similar to the openGL command gluLookAt(). Or, for a more OpenGL feel use D3DXMatrixLookAtRH().

Feel free to change the view matrix whenever you want to manipulate the "virtual camera".



[edited by - ZeroEffect on June 3, 2002 1:55:36 PM]

Share this post


Link to post
Share on other sites

  • 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!