Search code examples
cesiumjs

scene.viewer.camera.setView() does nothing


I am trying to set the initial view for the cesium scene camera. according to the camera tutorial it should be as easy as calling scene.viewer.camera.setView() — that however does not have any effect, in my case.

const viewer = new Cesium.Viewer('cesiumContainer', viewerOptions);
const { scene } = viewer;
const startPos = Cesium.Cartesian3.fromDegrees(4.8951722, 52.3710947, 150000);

// this works
viewer.camera.flyTo({
    destination: startPos,
});

// this doesn't
scene.viewer.camera.setView({
    position: startPos,
    // heading: 0.0,
    // pitch: -Cesium.Math.PI_OVER_TWO,
    // roll: 0.0
});

am I missing anything?

thanks in advance!


Solution

  • apparently it's destination: startPos, not position: startPos.