20 if (inputManager.IsMousePositionChanged())
22 const auto& oldPos = inputManager.GetMousePositionOld();
23 const auto& currentPos = inputManager.GetMousePositionCurrent();
25 float deltaX = currentPos.x - oldPos.x;
26 float deltaY = currentPos.y - oldPos.y;
29 float yDeltaAngle = -deltaX * m_sensitivity * deltaTime;
30 m_yRot += yDeltaAngle;
31 glm::quat yRot = glm::angleAxis(glm::radians(m_yRot), glm::vec3(0.0f, 1.0f, 0.0f));
34 float xDeltaAngle = -deltaY * m_sensitivity * deltaTime;
35 m_xRot += xDeltaAngle;
36 m_xRot = std::clamp(m_xRot, -89.0f, 89.0f);
37 glm::quat xRot = glm::angleAxis(glm::radians(m_xRot), glm::vec3(1.0f, 0.0f, 0.0f));
39 rotation = glm::normalize(yRot * xRot);
44 glm::vec3 front = rotation * glm::vec3(0.0f, 0.0f, -1.0f);
45 glm::vec3 right = rotation * glm::vec3(1.0f, 0.0f, 0.0f);
49 if (inputManager.IsKeyPressed(GLFW_KEY_A))
53 else if (inputManager.IsKeyPressed(GLFW_KEY_D))
58 if (inputManager.IsKeyPressed(GLFW_KEY_W))
62 else if (inputManager.IsKeyPressed(GLFW_KEY_S))
67 if (inputManager.IsKeyPressed(GLFW_KEY_SPACE))
69 m_kinematicController->Jump(glm::vec3(0.0f, 5.0f, 0.0f));
72 if (glm::dot(move, move) > 0)
74 move = glm::normalize(move);
76 m_kinematicController->Walk(move * m_moveSpeed * deltaTime);