Hi, I don`t undestand very well how the cameras work but I’m trying to do the following, in real life there are a lot of different cameras and one of the parameters of this cameras is the horizontal focus. Horizontal focus, given in degrees, is related to the degrees you can see of a scene. How could I change the “horizontal focus” of a camera in JME? I mean, the size of the window will be the same, but a camera with a focus of 180º and another one with 90º at the same point will see a different image.
Thanks!
This is the zoom method from FlyByCamera:
[java] protected void zoomCamera(float value){
// derive fovY value
float h = cam.getFrustumTop();
float w = cam.getFrustumRight();
float aspect = w / h;
float near = cam.getFrustumNear();
float fovY = FastMath.atan(h / near)
/ (FastMath.DEG_TO_RAD * .5f);
fovY += value * 0.1f;
h = FastMath.tan( fovY * FastMath.DEG_TO_RAD * .5f) * near;
w = h * aspect;
cam.setFrustumTop(h);
cam.setFrustumBottom(-h);
cam.setFrustumLeft(-w);
cam.setFrustumRight(w);
}[/java]
utsl
Hello!
I’m not sure exactly what you mean, but I think it’s related to “Field of view?” (Also known by it’s acronym of FoV) The angle of how much the lens sees?
I think you want to mess with the camera’s fov by using camera.setFrustrumPerspective. Now, I’ve never done this before, so I’m guessing around, but you’ll definitely be messing around with the camera’s parameters to pull this effect off.
Otherwise, I’d check out:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:camera
Cheers!
~FlaH
EDIT: zomg normen’s so fast! Ninja!