All examples By author By category About

nitaku

3D building with zoom and pan (three.js)

A slightly convoluted example, showing how to enable d3.js's zoom behavior on a 3D scene with ortographic camera in three.js (see the previous example). Since moving the camera seems difficult (and not supported by three.js's built-in controls), the code acts on the camera extents (top, bottom, left and right) and updates its projection matrix explicitly.

A different method for specfifying camera orientation is also used, which needs the definition of the camera's up vector.