D3DIM ordering

Started by
0 comments, last by Pseudo 24 years, 7 months ago
What is the proper order to do a scale, translation, and rotation...

if I have:

D3DVALUE scale;
D3DVECTOR pos,dir;
D3DMATRIX total, temp;
Identity(total);

then when I do this:

Scale(temp, scale);
Multiply(total, total, temp);
Rotate(temp, dir)
Multiply(total, total, temp);
Translate(temp, pos);
Multiply(total, total, temp);
pd3dDevice->SetTransform(D3DTRANSFORMSTATE_WORLD, &total);

Now, this should scale, then rotate around its local coord system, and then translate...but it is not working right. I think I read the the order must be fliped screwy when working with matrices. Could someone modify the above code, so that I can see what is going wrong?

Advertisement
1) Are you sure you do all your matrix-functions in the correct way ? If not, try out the functions from D3DUtil.cpp and then change back to your functions.

2) I normally multiplied all matrices in one function and it worked fine for me. This is also used in the DX SDK, so you could have a look at that. If you need some source for this, have a look at d3dutil.cpp and d3dmath.cpp, the functions can be found there.

3) I used to multiply with the rotation matrix at the beginning and then with the translation matrix, but I'm not sure if this does matter. (I'm not that experienced with 3d-coding)

I hope I could help a bit.

CU

------------------
Skullpture Entertainment
#40842461

Graphix Coding @Skullpture Entertainmenthttp://www.skullpture.de

This topic is closed to new replies.

Advertisement