#### Archived

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

# Objects, confusion and Matrices.

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

## 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 on other sites
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.

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

##### 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 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 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 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]

1. 1
Rutin
27
2. 2
3. 3
4. 4
5. 5

• 11
• 11
• 10
• 13
• 20
• ### Forum Statistics

• Total Topics
632948
• Total Posts
3009399
• ### Who's Online (See full list)

There are no registered users currently online

×