D3Dx9 Question. Matrix Transformations.

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • D3Dx9 Question. Matrix Transformations.

      Ok, so i'm trying to do some simple, or so i thought, transormations.

      Single transformations works fine, but i'm trying to do 2 each frame.

      Source Code

      1. D3DXMatrixRotationZ(&matWorld, (float)timeGetTime() / 1000.0f);
      2. D3DXMatrixRotationX(&matWorld, (float)timeGetTime() / 1000.0f);
      3. g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
      Resulting in only a X transformation.

      Source Code

      1. D3DXMatrixRotationZ(&matWorld, (float)timeGetTime() / 1000.0f);
      2. g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
      3. D3DXMatrixRotationX(&matWorld, (float)timeGetTime() / 1000.0f);
      4. g_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
      Resulting in only a X transformation.

      So i guess this is where I say I am lost. I do get that the last transformation is he one that is being stored... I thought it would be pretty simple to do 2 transformations at the same time... Guess Not. Is their a simple fix?
      Wort wort wort.

      The post was edited 1 time, last by Kaimera ().

    • RE: D3Dx9 Question. Matrix Transformations.

      Do I know 3D? Hell no. It looks to me, however, that you are passing the same transformation in twice in a row, giving you no real effect. I assume you mean for it to spin twice the same amount, but I don't know if it works that way (I'd have to crack out the old book). Why aren't you just dividing by 500 to get the same effect?
      -Larrik Jaerico

      www.LarrikJ.com
    • RE: D3Dx9 Question. Matrix Transformations.

      D3DXMatrixRotationX's second parameter is supposed to be a floating point number representing the number of radians of rotation.

      Also, timeGetTime returns the number of ms the computer has been on (right?) so your real problem is that you are sending in a tiny angle, resulting in a very small rotation.

      If you wanted to rotate something 90 degrees per second, you want to keep the old time around, subtract it from the current time - that would give you a delta time.

      Then, you'd multiply the delta time with the number of degrees you want to rotate every second.

      That should do it.
      Mr.Mike
      Author, Programmer, Brewer, Patriot