Hallo Leute,
in meinem aktuellem Projekt ist es notwendig, dass sich Objekte (x-mesches) um alle drei rotationsachsen rotieren lassen. damit meine ich , um die absoluten achsen des globalen koordinatensystems und nicht die des objekteigenen koordinatensystems. doch im folgenden code gelingt dies nur bei der z-achse, die beiden anderen werden im objekteigenen koordinatensystem rotiert.
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
D3DXMATRIX WorldMatrix;
D3DXMATRIX RotationMatrix;
D3DXMATRIX RotationMatrix_X;
D3DXMATRIX RotationMatrix_Y;
D3DXMATRIX RotationMatrix_Z;
D3DXMATRIX TranslationMatrix;
D3DXMatrixRotationX(&RotationMatrix_X, rotX);
D3DXMatrixRotationY(&RotationMatrix_Y, rotY);
D3DXMatrixRotationZ(&RotationMatrix_Z, rotZ);
D3DXMatrixMultiply(&RotationMatrix, &RotationMatrix, &RotationMatrix_Y);
D3DXMatrixMultiply(&RotationMatrix, &RotationMatrix, &RotationMatrix_X);
D3DXMatrixMultiply(&RotationMatrix, &RotationMatrix, &RotationMatrix_Z);
D3DXMatrixTranslation(&TranslationMatrix, transX, transY, transZ);
D3DXMatrixMultiply(&WorldMatrix, &RotationMatrix, &TranslationMatrix);
lpD3DDevice->SetTransform(D3DTS_WORLD, &WorldMatrix);
|
führt man allerdings die D3DXMatrixMultiply mit der x-achse als letzte der drei aus, so ist nur diese funktionstüchtig.
daher meine frage: kann mir vielleicht jemand sagen, wie ich alle drei achsen gleichberechtigt rtiere (im globalen koordinatensystem)?
vielen dank schon mal im vorhinein,
Fredy