Helper function for retrieving camera position and orientation in 3D coordinates
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Replaces #3845
Something like the example below only works in 3D because `camera.setView` and `camera.flyTo` expect the `destination` to be a `Cartesian3` in the 3D coordinate system. `positionWC` is in world coordinates, which needs to be unprojeted if you are in 2D or CV.
```js
var viewer = new Cesium.Viewer('cesiumContainer', {sceneMode: Cesium.SceneMode.SCENE2D});
var camera = viewer.scene.camera;
var position;
Sandcastle.addToolbarButton('Save', function() {
position = camera.positionWC.clone();
});
Sandcastle.addToolbarButton('Load', function() {
viewer.scene.camera.setView({
destination: position.clone()
});
});
```
Contributor guide
Research direction
Start with the camera APIs named in the example: positionWC, setView, flyTo, and SceneMode, then reproduce the Save/Load case in the Sandcastle viewer for 3D, 2D, and CV. Done means a helper can retrieve and restore camera position and orientation across those scene modes without passing world coordinates where Cartesian3 coordinates are expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100