jos
March 24, 2021, 5:17am
1
It’s possible to get the position of a mouse click on the world via event.position
so that an entity can be placed there. For example, here I’m drawing a line from one corner of this octagon to another:
This was taken using the default WGS84 ellipsoid. If I switch to the Cesium World terrain, I can do the same thing again without incident:
But then if I switch back to the WGS84 ellipsoid, the location reported by event.position
breaks and it starts reporting incorrect values. Note that in this image I clicked on the same two corners as before:
This does not happen with event.endPosition
, but that can’t be used in every circumstance.
Is this an engine bug? Or some implementation error that I can get around?
jos
April 20, 2021, 2:21am
2
@dzung should this be reported as an engine bug on github?
jos
April 28, 2021, 1:40am
3
This is now reported on github as a bug.
dzung
May 3, 2021, 8:30pm
4
Have you tried scene.pickPosition
(Scene - Cesium Documentation ) for terrain and camera.pickEllipsoid
(Camera - Cesium Documentation ) for the ellipsoid? It might be an issue with picking terrain versus picking the ellipsoid.
jos
May 5, 2021, 2:48am
5
@dzung I can try, but surely if I’m using the first function for both ellipsoid and terrain, and I switch from ellipsoid to terrain and then back to ellipsoid, it shouldn’t have made any lasting changes?
Or are you saying that the change to the world terrain model changes the scene.pickPosition
function permanently, because it’s now interacted with a terrain model over an ellipsoid model?
EDIT: Just gave this a try by making a function to return a position dependent on what terrain model the Viewer is using - I still ran into the same issue.
dzung
May 7, 2021, 7:13pm
6
This might be a potential bug. Are you able to share a Sandcastle example of the code?
jos
May 8, 2021, 1:04am
7
@dzung There’s one in the github issue report - it’s a sandcastle that’s not specifically about that bug but shows that it it exists.
opened 01:38AM - 28 Apr 21 UTC
type - bug
Browser: Chrome
OS: Kubuntu 20.04
Sandcastle Link: [Bug occurs in any cesium a… pplication that uses the position. In this example, go to any position and take the lat long of it; then switch world terrain on/off and check the position again (it will have changed)](https://sandcastle.cesium.com/index.html#c=lVVtb9s2EP4rB3+RnLqU7RVoIdnBuiTDBiTosHqvMDDQ1NkiQpECSdlxiv73HWVLfqsHTJ9I3j13z70qSeA3hyCUrCqpV1AprtGBN+BQofByjWoLhcwRKm69A7MEXyCslFkguNouuUA213O95hbWEjdoYQoaN3CHTtYl+715iyPRXO+M9lxqtNEAvsw10Oeetx99aVxVoMUUllw5HOxFhalV/lHLknuEFLytW5FHa8nQL9asiZxNW3fCIun+YazKZzuVuD/XX/tZ4EgsGzbs1ZhyZuL9DbWXXqILSmdPjOd5vCcq8xSi0tTRnoLiC1RpG0b4kgQq4whoNHSM7ihvdOJ6zP5++PXTAA76FN/mJKqve6p7Fk6gRiY4Jbdh8rAmXo/SeXqmlBIXh6VZIyVzWWsR/MbYbxmFijRxbKki53Gt0P+w/TlvjETBZYdQ1AvOyPwA2tFoSs468R5CIT8FGkA07FFrNB2EzYOgBJiV5VUhxSE/B4+iTdDBo+AlWs4qKZ4fWofxUVN1Of0upvwoSWH9OYD2+Fd/cAijjU0uIe489Y+r1nLoOE4PaNZBZubuSOfIVHZqSRm9kr7O8bO3YaKmLecn7gvmzT2uLKKLjz2yDtQnjR/lC+bxaHhhmfv/b3iPuWZ31x+sq8r0UI1LrabhWWha0gtde01lSVP+j/NbhaT44d01tVw6vlB4j5UvZuj8PXU21yKARmz8/t14OPoANzAaws0NvM+O5+yM9/TKsGVwxbXHF09uojiCNxclewM0UI3gNOP03o/OimLR1SqYujCfhdnYhPbXpBVGxBfSHdC5EXVJqDCKDwrDsZnIeS+noZ73+kxqGvOfZk+P3zS/3xjUq2T6y38Xq1mq2emOmeveoDdpqnS7k3wvy8pYD7VVMWOJx5J+B5TOZFGLZ/RMuGZFTpIWNMnlmtbitKUMjWAavb6VOseXFMbD4TDrZj4FvnBG1R4zKFCuCp+OhsPqJYONzH2RjncX20io7OGyMN6bMoXmEuJ+K4wytO83hfQY3U4S4nBC5exHQ6yE4s6RZFkr9Vm+4rz3DZgyPKcif6I1pvg2qBSj28fdI2NsktD1EuWNUQtujyz+Cw)
This is in accordance with https://community.cesium.com/t/viewer-event-position-breaks-after-enabling-then-disabling-world-terrain-model/12732.
It’s possible to get the position of a mouse click on the world via `event.position` so that an entity can be placed there. For example, here I’m drawing a line from one corner of this octagon to another:
[Image Link - working WGS84](https://global.discourse-cdn.com/cesium/original/2X/0/07f027bee77ce4efbed0e4f8b8c1de21b5eca830.jpeg)
This was taken using the default WGS84 ellipsoid. If I switch to the Cesium World terrain, I can do the same thing again without incident:
[Image Link 2 - working properly with terrain enabled](https://global.discourse-cdn.com/cesium/original/2X/5/5ea50944c821be6648a9cea3984721d05925524b.jpeg)
But then if I switch back to the WGS84 ellipsoid, the location reported by event.position breaks and it starts reporting incorrect values. Note that in this image I clicked on the same two corners as before:
[Image Link 3 - the bug occuring after switching back to WGS84](https://global.discourse-cdn.com/cesium/original/2X/4/4f588c7ce7d65b850814ac163f73d8be60f99e21.jpeg)
This does not happen with `event.endPosition`, but that can’t be used in every circumstance.
Strangely enough, this occurs when switching between any terrain model present in that menu:
[The menu in question](https://global.discourse-cdn.com/cesium/original/2X/0/08f6986313cdc510ca923440bfb7d492cc46b953.png)
If I remove the world terrain option and replace it with my own terrain model, the same bug will occur.
The sandcastle I linked to is Cesium Sandcastle - switch between the world terrain and back and see that coordinates for a specific location will change.
1 Like