camera: allow to strafe up and down
parent
cf0bb3f111
commit
b1e420f564
|
@ -33,6 +33,12 @@ public:
|
|||
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
|
||||
this->cameraPos += glm::normalize(glm::cross(cameraFront, cameraUp)) * cameraSpeed;
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
|
||||
this->cameraPos += cameraSpeed * cameraUp;
|
||||
if (glfwGetKey(window, GLFW_KEY_Z) == GLFW_PRESS)
|
||||
this->cameraPos -= cameraSpeed * cameraUp;
|
||||
|
||||
|
||||
direction.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));
|
||||
direction.y = sin(glm::radians(pitch));
|
||||
direction.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));
|
||||
|
@ -92,7 +98,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
glm::vec3 cameraPos = glm::vec3(static_cast<float>(CHUNK_SIZE)*24, 80.0f, static_cast<float>(CHUNK_SIZE)*24);
|
||||
glm::vec3 cameraPos = glm::vec3(static_cast<float>(CHUNK_SIZE)*24, 40.0f, static_cast<float>(CHUNK_SIZE)*24);
|
||||
glm::vec3 cameraFront = glm::vec3(0.0f, 0.0f, -1.0f);
|
||||
glm::vec3 cameraUp = glm::vec3(0.0f, 1.0f, 0.0f);
|
||||
glm::vec3 direction = glm::vec3(0.0f);
|
||||
|
|
Loading…
Reference in New Issue