I’m trying to make it so that no matter how far apart two objects are they’ll both remain on screen.
This is what I got so far:
float distance = (float) ((Math.sqrt((p1.x - p2.x) + (p1.y - p2.y))));
float camx = (float)((p1.x + p2.x) * 0.5);
float camy = (float)((p1.y + p2.y) * 0.5);
float camz = (float) (distance * 5);
What is the math I need so the Z zooms in and out correctly?