Java 如何计算世界空间中的摄影机上方向向量

Java 如何计算世界空间中的摄影机上方向向量,java,opengl,lwjgl,Java,Opengl,Lwjgl,我试图用以下变量计算相机上方向向量: private Vector3f targetPosition = new Vector3f(0, 0, 0); private Vector3f camPosition = new Vector3f(0, 0, 0); private float pitch = 20; // y rotation \\ private float yaw = 0; // x rotation \\ 我怎样才能做到这一点呢?世界空间中的上方向向量是向上的,或者任何你想定义

我试图用以下变量计算相机上方向向量:

private Vector3f targetPosition = new Vector3f(0, 0, 0);
private Vector3f camPosition = new Vector3f(0, 0, 0);
private float pitch = 20; // y rotation \\
private float yaw = 0; // x rotation \\

我怎样才能做到这一点呢?

世界空间中的上方向向量是向上的,或者任何你想定义为“向上”的东西。正常情况下,“向上”只是一个正y:

private const Vector3f UP = new Vector3f(0.0f, 1.0f, 0.0f);

目标位置不能等于相机的位置-除非您通过“目标”表示其他内容。此外,如果您还指定了
目标,则
偏航
滚动
有什么意义?通常,您会将模型视图矩阵应用于向量(0,1,0)。这听起来像是一个学校作业问题,而不是现代opengl的情况