A
A
Anthony2283572021-02-04 21:25:19
3D
Anthony228357, 2021-02-04 21:25:19

How to correctly calculate vectors for a camera in 3d?

By default, the forward vector for Euler angles is calculated:

x = cos(yaw)*cos(pitch)
y = sin(yaw)*cos(pitch)
z = sin(pitch)

But in one of the guides I found another view:
front.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch));
front.y = sin(glm::radians(Pitch));
front.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch));

Which implementation is better and why?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question