Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ThreeJS: update camera FOV

I'm trying to update a camera field of vision without creating a new camera. I've been able to do this with position by using the code below:

camera.position.set()

I'd like to set this up in a similar way with the fov:

camera.fov.set()

This isn't working in the script. Can anyone else suggest a quick method?

like image 440
ekatz Avatar asked Mar 06 '14 00:03

ekatz


1 Answers

You need to recompute the projectionMatrix:

camera.fov = 20;
camera.updateProjectionMatrix();

This may be prettified in the future though...

like image 99
mrdoob Avatar answered Oct 10 '22 19:10

mrdoob