float xRotation[3][3]; float yRotation[3][3]; float zRotation[3][3]; float xVec[3] = {1.0, 0.0, 0.0}; float yVec[3] = {0.0, 1.0, 0.0}; float zVec[3] = {0.0, 0.0, 1.0}; VecRotToMat3( &xVec[0], yaw, xRotation); VecRotToMat3( &yVec[0], pitch, yRotation); VecRotToMat3( &zVec[0], roll, zRotation); float xInv[3][3]; float yInv[3][3]; float zInv[3][3]; for (int i=0; i < 3; i++) { for (int j=0; j < 3; j++) { xInv[i][j] = xRotation[j][i]; yInv[i][j] = yRotation[j][i]; zInv[i][j] = zRotation[j][i]; } } MT_Matrix3x3 newOrient = MT_Matrix3x3(&xRotation[0][0]) * MT_Matrix3x3(&yRotation[0][0]) * MT_Matrix3x3(&zRotation[0][0]); MT_Matrix3x3 invOrient = MT_Matrix3x3(&xInv[0][0]) * MT_Matrix3x3(&yInv[0][0]) * MT_Matrix3x3(&zInv[0][0]); ////ob->SetLocalOrientation(newOrient); ob->SetLocalOrientation(invOrient);