Hello! I want to set a new camera viewport according to an object position but I have no idea how to do that.
There is a simple way to get screen coordinates and convert it to viewport coordinates?
I want to show a camera in a specific position at the screen.
For now I have a quad and a text where I want to put the camera.
Here is my code:
Vector3f textPos = obj.getWorldTranslation().clone();
Vector3f newPos = getCamera().getScreenCoordinates(textPos);
newPos.setY(newPos.y + 100f);
newPos.x - 8f, newPos.y - 35f, newPos.z - 1f
Camera camera2 = getCamera().clone();
camera2.setViewPort(x1, x2, y1, y2); //I need to find out these values.
Thanks in advance!