Graphics Reference
In-Depth Information
Zooming the camera to an object
Usually, when you position a camera in your scene, you might move it around a bit or
let it focus on different objects. In this recipe, we'll show you how you can zoom in to
an object so that it almost fills the rendered view.
Getting ready
To zoom in, we use the standard functionality from the THREE.PerspectiveCamera
object. We've provided an example that demonstrates the result you'll get at the end
of this recipe. To experiment with this example, open 03.02-zoom-camera-to-ob-
ject.html in your browser. You will see something similar to the following screen-
shot:
Initially, you'll see a small rotating cube in the center of the scene. If you click on the
updateCamera button in the menu in the top-right section, the camera will update
and show you the rotating cube fullscreen like this:
Search WWH ::




Custom Search