我想围绕它的轴旋转模型,而不是围绕世界轴。这可以在不转移模型的情况下完成吗?我找到了一篇关于四元数的文章,但我的模型仍然围绕世界轴旋转。也许我误解了这篇文章。这是我的代码:
void Model::rotateAroundModelAxis(vec3 EulerAngles)
{
quat quaternion = quat(EulerAngles);
rotationMatrix = mat4_cast(quaternion);
}
mat4 Model::ModelMatrix()
{
return translationMatrix * rotationMatrix * scaleMatrix;
}
旋转矩阵相对于原点起作用。因此,模型最初必须围绕其旋转中心构建,并且只有在最后,translationMatrix 才会将模型转移到世界上正确的位置)
最有价值球员:
Model Matrix 是
translationMatrix * rotationMatrix * scaleMatrix
(倒序)View Matrix 是相机方向和方位(LookAt)
Projection Matrix 是透视畸变
不错的教程