block by nitaku b25e6f091e97667c6cae

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

Full Screen

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.

index.js

index.html

index.coffee

index.css