Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera.getRectangleCameraCoordinates doesn't account for terrain #4807

Open
hpinkos opened this issue Jan 4, 2017 · 3 comments
Open

Camera.getRectangleCameraCoordinates doesn't account for terrain #4807

hpinkos opened this issue Jan 4, 2017 · 3 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Jan 4, 2017

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/R7CLnK9PZE8

In this example, the camera zooms to span where the rectangle would be on the WGS84 ellipsoid, which is zoomed in too far for where the rectangle is on the terrain surface.

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
     url : '//assets.agi.com/stk-terrain/world'
 });

var west = -45.977340999999605;
var south = -21.417668000000273;
var east = -45.96351400000036;
var north = -21.403251000000008;
var rectangle = new Cesium.Rectangle.fromDegrees(west, south, east, north);
viewer.entities.add({
    rectangle : {
        coordinates: rectangle,
        material: Cesium.Color.RED.withAlpha(0.5)
    }
});

Sandcastle.addToolbarButton('Set View', function() {
    viewer.camera.setView({
            destination: rectangle                     
    }); 
});
@Orex0v
Copy link

Orex0v commented Dec 5, 2023

Hi. Any progress on this issue?

@ggetz
Copy link
Contributor

ggetz commented Dec 5, 2023

Hi @Orex0v, there hasn't been any updates on this item recently.

If you'd like to add more information about your use case, that may help us prioritize.

If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR.

Thanks!

@Orex0v
Copy link

Orex0v commented Dec 6, 2023

@ggetz I need to point the camera at a Rectangle on terrain
Now scene.globe.getHeight doesn't take terrain into account and because of this the camera can go under the ground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment