How to pick the accurate coordinates

I want to display the coordinates and measure the distance on a 3D model or point cloud.
There is a way to pick coordinates with “Scene.pickPosition”, but we don’t think this method will allow us to pick the exact coordinates.

In Example 1 below, a yellow dot is placed on the 3D model when you click on it.
The coordinates to place it are the result of “Scene.PickPosition”.
If you place it and then zoom in, the yellow dot is not on the 3D model, but underneath it.
It captures a close position, but it is not precise enough.

Exsample 1:

Also, in the next sample, there is a (hard to see) one-pixel pink point that is When you mouse hover, a yellow point is placed.
If you zoom in, the yellow point is at a different coordinate than the pink point.

Exsample 2:

Please let me know if there is a way to get the accurate coordinates from the 3D tiles of 3D model or point cloud.
Thank you for your help.

Welcome to the Cesium community @nknk!

In your first example, I think the point is exactly in the right location. It may appear underneath the 3D model only because it is exactly on the surface and there may be z-fighting occurring there. If you create the point as a 3D sphere instead you can confirm it’s at the right location.

Sandcastle.

For your second example, the point you’re picking does not have a fixed size in world space. Its size will always be 1 pixel on the screen. If you pick its position, and then zoom in, the point shrinks relative to world space, so that’s why the drawn point does not match.

This is going to be different if you have a point cloud as 3D Tiles. The point positions are not stored on the CPU, so they can’t be retrieved directly. This GitHub issue talks a bit about this: https://github.com/CesiumGS/cesium/issues/7953

Can you describe your use case a bit more? It may be possible to accomplish what you’re trying to do through other methods.

1 Like