question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scene.pickPosition returns incorrect position

See original GitHub issue

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

The user created this sandcastle example to demonstrate the problem: http://hosting.virtualcitysystems.de/demos/temp/pickProblem/Apps/Sandcastle/?src=3D Tiles.html&label=undefined

The demo is using the latest 3d-tiles branch

pickPosition works fine if you run the example inside sandcastle, but if you click ‘Open in New Window’ sometimes the returned position sits in front of the building you clicked instead of where the click intersects with it. Maybe it’s related to the canvas ratio? See the forum post for more details.

I couldn’t reproduce this with any of our sample models, but I asked the user if he could share a tile for us to test with.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:29 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
duvifncommented, Feb 13, 2017

@emackey

  1. I’m not sure that the ‘jittering’ in your animation is due to the pickPosition results . On my machine, If I set eyeOffset.z to a fixed value this doesn’t happen.

  2. I think it’s worth adding scene.globe.depthTestAgainstTerrain = true; to the code in your comment, because this is not the default in the sandcastle. pickPosition returns different values on terrain if depthTestAgainstTerrain == false , usually below the ellipsoid surface (maybe of the DepthPlane).

  3. The Alt string in this example code is truncated so it shows an wrong height. for example: -143976.41485355987 becomes 3976.41.

1reaction
kringcommented, Jan 19, 2017

In looking at this while debugging #4855, I saw a case where I had only a single frustum, and yet the position returned by pickPosition was wildly wrong. For example, values in pickGlobe in ScreenSpaceCameraController.js:

image

That’s without anything in the scene except for the globe (and sun and moon and such I suppose, but not explicitly-added primitives).

So I don’t think it’s necessarily multi-frustum related.

Read more comments on GitHub >

github_iconTop Results From Across the Web

scene.pickPosition return undefined / incorrect position in ...
I am trying to add a simple tool that measures straight line distance between two points using scene.pickPosition and scene.globe.pick.
Read more >
scene.pickPosition returns from time to time incorrect values
Most of the times it returns a correct position, but sometimes it seems that the returned point lies some distance (like 10 meters...
Read more >
scene.pickPosition returns incorrect position - - Bountysource
pickPosition works fine if you run the example inside sandcastle, but if you click 'Open in New Window' sometimes the returned position sits...
Read more >
QGraphicsItem returns wrong position in scene. (Qt4.7.3)
I've had problems with QGraphicsRectItem as well. My current hypothesis is this: The "rect" that you set/get is relative to the item's "pos" ......
Read more >
Cesium projection system - GIS Stack Exchange
The Picking Demo shows one example of this conversion happening: var cartesian = viewer.scene.pickPosition( ... ); if (cartesian) { var ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found