3 ms·
How come y is z.cross(x) and not up? Edit: I think it has been answered by others - up is in world-space, and the camera is not necessarily aligned horizontall
by abaines 6y ago
How come y is z.cross(x) and not up?
Edit: I think it has been answered by others - up is in world-space, and the camera is not necessarily aligned horizontally.
- tripletao 6y agoWe've already defined z and x by that stage, and we need y to be a unit vector perpendicular to both. So y can only be z.cross(x) (or x.cross(z) for mirrored).
- layoutIfNeeded 6y agoYep, the up vector is not necessarily orthogonal to the direction vector (which is also called “look at” vector in OpenGL [1]). Another approach would be to set y = up.reject(direction).normalized() where a.reject(b) = a - b.project(a) [1] https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml...