Calculating camera position based on frustum doesnt work?


I try to calculate so that the topleft pixel on my screen is looking at the point 0,0,0 in the 3d space.

I made a formula based on trigonometry but it calculates wrong by about 1,5 units in x.

[java]float x = (float) (-distance*Math.tan(cam.getFrustumLeft()));

float y = 0;

System.out.println("X: "+x);

topleft = new Vector3f(x,y,distance);[/java]

Isn’t FrustumLeft the angle (in radians) from the center to the left?

Nvm, I’ll just switch to pararell projection. Makes math and everything much simpler anyways…