Home > Software engineering >  D3D model in the rotation
D3D model in the rotation

Time:09-21

Assume that rotation using the following code:

Question:
X axis rotate yaw Angle, then the Y axis rotate Angle of pitch, but found that after the X axis rotate, actually Y also have changed, is no longer the original parallel to the Y axis of the screen, now the Y axis is perpendicular to the XoZ plane, a point of view, that is to say, and screen
But I want is the result of the circles X, Y, Z axis is tilted, three axis is the original state, then the Y axis rotate, so how to implement, please

CodePudding user response:

http://blog.csdn.net/pizi0475

CodePudding user response:

This can't directly pass the axis of rotation, in the province of you one by one

CodePudding user response:

refer to the second floor wangyaninglm response:
this can't directly pass the axis of rotation, save you a a numerical


 D3DXVECTOR3 vX (0, 1); 
D3DXVECTOR3 vY (0, 0);
D3DXVECTOR3 vZ (0, 1);

D3DXMATRIX matX, matY, matZ;
D3DXMatrixRotationAxis (& amp; MatX, & amp; VX, yaw);
D3DXMatrixRotationAxis (& amp; MatY, & amp; VY, pitch);
D3DXMatrixRotationAxis (& amp; MatZ, & amp; VZ, 0);

D3DXMATRIX matWorld;
D3DXMatrixMultiply (& amp; MatWorld, & amp; MatX, & amp; MatY);
D3DXMatrixMultiply (& amp; MatWorld, & amp; MatWorld, & amp; MatZ);


Like this?

CodePudding user response:

Y rotate first, then X rotate, also is to obtain XYZ3 a axis of rotation matrix so take
RotationZ RotationX RotationY * *, this is the basic characteristic of the FPS/FreeCamera
  • Related