【发布时间】:2020-07-01 19:03:44
【问题描述】:
我有一个对象的世界矩阵object_world,该对象已在世界空间的某个地方进行了翻译。我想使用四元数围绕它的局部 x 坐标轴旋转。我该怎么做?
现在我只能像这样围绕世界 x 轴旋转:
XMVECTOR right = XMVectorSet(1.f, 0.f, 0.f, 0.f);
XMVECTOR right_rot_quat = XMQuaternionRotationAxis(right, XM_PIDIV4);
XMMATRIX rot_mat = XMMatrixRotationQuaternion(right_rot_quat);
object_world = object_world * rot_mat;
【问题讨论】:
标签: graphics directx linear-algebra