Trying to make some code to look at a specific point in the world. ChatGPT isn't helping. Probably should have paid attention in school. Here's what I have so far (it doesn't work very well but Y is on to something)
public void lookAtCoordinate(Vector3f target) {
double xSide = target.x - position.x;
double ySide = target.y - position.y;
double zSide = target.z - position.z;
setRotation((float) Math.toDegrees(Math.acos(xSide / ySide)), (float) -Math.toDegrees(Math.acos(xSide / zSide)), 0);
//setRotation(target.x - position.x, target.y - position.x, 0;
}
Help?
Game controls:
Game.newKeybind(GLFW_KEY_S, () -> { Game.cameraInc.z = 1; });
Game.newKeybind(GLFW_KEY_W, () -> { Game.cameraInc.z = -1; });
Game.newKeybind(GLFW_KEY_D, () -> { Game.cameraInc.x = 1; });
Game.newKeybind(GLFW_KEY_A, () -> { Game.cameraInc.x = -1; });
Game.newKeybind(GLFW_KEY_SPACE, () -> { Game.cameraInc.y = 1; });
Game.newKeybind(GLFW_KEY_LEFT_SHIFT, () -> { Game.cameraInc.y = -1; });