Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1019 Bytes

controllingTheCamera.md

File metadata and controls

43 lines (28 loc) · 1019 Bytes

Controlling the Camera

A xeometry viewer has a camera that you can move around the scene.

The camera's position is represented by three World-space vectors:

  • eye - the position of your eye,
  • look - the point you're looking at
  • up - the direction of "up"

Set and get those properties to manage the camera position.

Note that these properties are the only state that xeometry tracks for the camera position. In other words, as you rotate, pan and zoom the camera, xeometry does not remember your rotation angles or translation offsets.

Examples

Setting eye, look and up separately:

viewer.setEye([0,0,-100]);
viewer.setLook([0,0,0]);
viewer.setUp([0,1,0]);

Setting eye, look and up in one shot:

// Eye, look and "up" vector
viewer.setEyeLookUp([0,0,-100],[0,0,0],[0,1,0], function() {
    // Camera arrived
});

Getting the camera position:

var eye = viewer.getEye();
var look = viewer.getLook();
var up = viewer.getUp();