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

When globe.translucency.enabled = true, the scene.pickPosition(ev.position) will be return a Incorrect value #10806

Closed
laobel opened this issue Sep 22, 2022 · 2 comments

Comments

@laobel
Copy link

laobel commented Sep 22, 2022

Copy the following code to Sandcastle and run it. Click the same location multiple times to return different results.

const viewer = new Cesium.Viewer("cesiumContainer");

viewer.scene.globe.depthTestAgainstTerrain = true;

function test(){
viewer.scene.globe.translucency.enabled = !viewer.scene.globe.translucency.enabled;
}

let scene = viewer.scene;
let globe = scene.globe;

scene.screenSpaceCameraController.enableCollisionDetection = false;
globe.translucency.frontFaceAlphaByDistance = new Cesium.NearFarScalar(50.0,0.0,100.0,1.0);
globe.translucency.enabled = true;
globe.translucency.frontFaceAlphaByDistance.nearValue = Cesium.Math.clamp(0.3, 0.0, 0.1);
globe.translucency.frontFaceAlphaByDistance.farValue = 1.0;

let handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
var cartesian = viewer.scene.pickPosition(movement.position);
console.log(cartesian);
test();
},Cesium.ScreenSpaceEventType.LEFT_CLICK);

@lilleyse
Copy link
Contributor

Normally you would also need to set viewer.scene.pickTranslucentDepth = true;

But that doesn't seem to be working for the globe, only for other translucent objects.

@ggetz
Copy link
Contributor

ggetz commented Jan 23, 2023

I think this falls under #4368. Closing this as a duplicate.

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

No branches or pull requests

3 participants