I'm working on a pseudo-3D raycasting game and I want to implement looking with the mouse. I tried to make it independent from fps by multiplying the mouse input with the time between frames. Here's my code:
public void mouseLook() {
GLFW.glfwGetCursorPos(Window.window, mouseX, mouseY);
mouseX.rewind();
mouseY.rewind();
viewAngle += (mouseX.get(0) - (Window.width / 2.0)) * Window.frameTime;
if (viewAngle > 2 * Math.PI) viewAngle -= 2 * Math.PI;
if (viewAngle < 0) viewAngle += 2 * Math.PI;
dX = Math.cos(viewAngle);
dY = Math.sin(viewAngle);
GLFW.glfwSetCursorPos(Window.window, Window.width / 2.0, Window.height / 2.0);
}
What am I doing wrong?