ekatz
ekatz

Reputation: 1070

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?

Upvotes: 33

Views: 18189

Answers (1)

mrdoob
mrdoob

Reputation: 19602

You need to recompute the projectionMatrix:

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

This may be prettified in the future though...

Upvotes: 72

Related Questions