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

sampleHeight bug #7120

Closed
hieeyh opened this issue Oct 8, 2018 · 4 comments
Closed

sampleHeight bug #7120

hieeyh opened this issue Oct 8, 2018 · 4 comments

Comments

@hieeyh
Copy link

hieeyh commented Oct 8, 2018

code:
let cartographicPosition = new Cesium.Cartographic()
cartographicPosition.longitude = mapUtil.angleToRadian(113.939499)
cartographicPosition.latitude = mapUtil.angleToRadian(22.5262237)
let takeOffheight = scene.sampleHeight(cartographicPosition)

result:
TypeError: Cannot read property 'x' of undefined
at n (Cesium.js:445)
at Function.s.fromCartesian (Cesium.js:445)
at we.sampleHeight (Cesium.js:526)

@lilleyse
Copy link
Contributor

lilleyse commented Oct 8, 2018

Hi @hieeyh

What happens when you click "Sample height" and "Sample height supported" in this demo?

Demo

It's possible that sampleHeight isn't supported on your setup. sampleHeightSupported would be the first thing to check.

@hieeyh
Copy link
Author

hieeyh commented Oct 9, 2018

Hi @hieeyh

What happens when you click "Sample height" and "Sample height supported" in this demo?

Demo

It's possible that sampleHeight isn't supported on your setup. sampleHeightSupported would be the first thing to check.

If theris a 2D billboard, it will report this error. But if exclude this 2D billboard, sometimes success, sometimes fail.

@lilleyse
Copy link
Contributor

Thanks @hieeyh, I can replicate the bug with this example.

It throws the error if the picked object doesn't write depth, like when disableDepthTestDistance : Number.POSITIVE_INFINITY is set in the example. The fix would be to pick through those objects. I should be able to incorporate the fix in #7115.

As a workaround you can add any billboards or other objects not meant to be sampled to the objectsToExclude array: https://cesiumjs.org/Cesium/Build/Documentation/Scene.html?classFilter=Scene#sampleHeight.

lilleyse added a commit that referenced this issue Oct 15, 2018
lilleyse added a commit that referenced this issue Oct 15, 2018
lilleyse added a commit that referenced this issue Oct 15, 2018
@lilleyse
Copy link
Contributor

The example I posted should now work in #7115.

Example on offscreen-picking branch

@hieeyh if you have a chance would you mind testing your app with this build to see if it fixed your problem?

A link to download the build is here: http://cesium-dev.s3-website-us-east-1.amazonaws.com/cesium/offscreen-picking/Cesium-1.49.0-offscreen-picking29051.zip

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