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

Clarify the need to call scene.render in between picks with pickTranslucentDepth in docs #6151

Closed
bkuster opened this issue Jan 24, 2018 · 3 comments
Labels
category - doc good first issue An opportunity for first time contributors

Comments

@bkuster
Copy link
Contributor

bkuster commented Jan 24, 2018

I'm trying to pick the position of a translucent primitive as outlined in #4511, which was closed with #4979.

What I expected: setting the scene.pickTranslucentDepth to true will allow me to not pick through translucent primitives, but this is not the case. Am I missunderstanding the docs?

Set Scene#pickTranslucentDepth to true to include the depth of translucent primitives

To recreate use this sandcastle and add this at line 5:

viewer.scene.pickTranslucentDepth = true;
viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
    var pickedFeature = viewer.scene.pick(movement.position);
    if (!Cesium.defined(pickedFeature)) {
        console.log("nothing");
        return;
    }

    console.log(viewer.scene.pickPosition(movement.position));
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Clicking on the translucent wall Primitive or one of the rectangles in the Atlantic when facing the horizon will not pick the position of the Primitive but log undefined.

@hpinkos
Copy link
Contributor

hpinkos commented Jan 24, 2018

Hi @bkuster. You need to call scene.render between picks. This fixed the example for me:'

viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {
    var pickedFeature = viewer.scene.pick(movement.position);
    if (!Cesium.defined(pickedFeature)) {
        console.log("nothing");
        return;
    }
    viewer.scene.render();
    console.log(viewer.scene.pickPosition(movement.position));
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

In the future, please ask questions like this on the forum: https://groups.google.com/forum/?hl=en#!forum/cesium-dev
We use GitHub exclusively for tracking bugs and planning new features. Thanks!

@hpinkos hpinkos closed this as completed Jan 24, 2018
@ggetz ggetz reopened this Jan 25, 2018
@ggetz ggetz added category - doc good first issue An opportunity for first time contributors labels Jan 25, 2018
@ggetz ggetz changed the title Picking translucent positions not working as expected Clarify the need to call scene.render in between picks with pickTranslucentDepth in docs Jan 25, 2018
@ggetz
Copy link
Contributor

ggetz commented Jan 25, 2018

@hpinkos Reopened to make this clear in the reference docs.

See https://groups.google.com/forum/#!topic/cesium-dev/C-yXSf6-8aQ

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/C-yXSf6-8aQ

If this issue affects any of these threads, please post a comment like the following:

The issue at #6151 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category - doc good first issue An opportunity for first time contributors
Projects
None yet
Development

No branches or pull requests

4 participants