bad-select.zip (1.8 KB)
I have an example with two polygons clamped to ground on Cesium World Terrain.
I am getting an inconsistent pick (using either drill-picking or just pick) where the wrong entity is returned to me.
I looked at a similar post that talked about render order-of-operations which is probably playing into effect here.
I’ve attached my simple code example, can anyone help to sort this out?
It only occurs on certain parts of the polygon and happens more often at low angles to the ground.
I’ve had this behavior happen at 100+ meter distances as well.
Hey, any chance you could create a Sandcastle with your code to show the problem?
Good point, here’s a link to make life a bit easier:
Hmm, I think your inaccuracies are not with pick()/drillPick(), but how and where you set selectedEntity. Try clicking into a polygon to select, then click outside, then back inside a polygon; I have no issues at all, it all has to do with the fact that set selected color before you find and set the next selected.
It’s an issue that occurs inconsistently and more often when you target the top-left corner of the upper polygon.
Don’t move the camera when it first loads in.
It will occur even if you don’t touch the second polygon. The highlighting logic is very simple so unless you can spot a direct error in it I don’t believe that’s the problem.
Try do repeated clicks on/off at the corner like the gif I attached.
randomizing the colour each click
Here is an example where I randomize the clicked entity’s colour instead of having a single highlighted entity to prove my point
Yup, you’re right, there’s something going on. I turned off the terrain, and that made it … a bit better, but repeated clicking on the same polygon returns often (but not always) more than the one polygon you’re clicking on. At first I thought it had to do with the size of the ray window, but even on the smallest setting it returns multiples. Clicking between the polygons always yields nothing, so it’s not a problem with the ray picking itself at a first glance. Some Cesium guys needs to look at it, though, it’s almost like when you hit a polygon it does another pick at a greater window and return those. It’s also random in which order they come, so definitely a bug.
I would suggest that you lodge a bug ticket in their Git repo, with a link to this post and the Sandcastle.
Thanks for the sanity check.