如何计算世界空间中的相机向上矢量

时间:2019-05-09 17:53:48

标签: 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 \\

我该如何实现?

1 个答案:

答案 0 :(得分:1)

上升世界空间中的向量刚好或您要定义为“上升”的任何值。通常,上升只是一个正y:

private const Vector3f UP = new Vector3f(0.0f, 1.0f, 0.0f);
相关问题