Rotating the camera around a scene

In Chapter 2, Geometries and Meshes, we already showed you a number of recipes that explained how to rotate objects. In this recipe, we'll show you how to rotate the camera around a scene while the camera will keep looking at the center of the scene.

Getting ready

For this recipe, we'll use the standard THREE.PerspectiveCamera object, which we rotate around a simple scene. To see the final result, open the 03.08-rotate-camera-around-scene-y-axis.html example in your browser.

Getting ready

On this web page, you can see that the camera rotates around the scene while the floor, box, and lights stay at the same position.

How to do it... ...

Get Three.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.