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

How to calculate a camera up vector in world space

我正在尝试使用这些变量计算相机向上矢量:

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 \

我怎样才能做到这一点?

世界 space 中的向上矢量就是向上或任何您想定义为 "up" 的东西。通常 up 只是一个积极的 y:

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