pickPosition affected by label background

Hi there,

I use scene.pickPosition() for all sorts of stuff, including dragging handles around in a drawing application. I’m displaying some live numbers as a label on a billboard (which acts as a handle for dragging a line around).

The problem is that if I drag a handle around, pickPosition() returns a null if I drag that handle over any label that has showBackground= true. If I set it to false, I can drag across labels fine, including through the text itself.

Any hints on how to solve this problem? I like a background on the label for readability, and it’s a shame that it disables pickPosition() in such a dramatic way?

Cheers,

Alex

I can’t seem to reproduce this behavior. Here’s a Sandcastle with one label having a background and one without. I get a position regardless of which one I click on.

I do seem to recall there being a GitHub issue on exposing a allowPicking property on entities, so you can use that to ignore specific entities like labels, but I can’t seem to find that issue. If you have a Sandcastle to reproduce we can open an issue for that.

Hi there,

Thanks for giving it a try and a test castle. I think my problem is linked to pickPosition() giving the position of the label it hits, but with me, I’ve got a filter on a matrix of positions (a fix for accurate hits in a pointcloud). Without the background there’s a much larger chance of slipping past the label, but with the background you’re guaranteed to hit it.

Thanks for clearing that up. I guess the real issue is if pickPosition() should hit a label at all. Currently it does, but maybe in the future there could be a way filter out what you want to regard as a hit? A tileset is fine, but an entity maybe not? I can do this with drillPick(), but there’s no such option with pickPosition() unless I’m mistaken?

Cheers,

Alex

Yes, I think that would be the right approach. This is actually currently possible with the Primitive API. You can set allowPicking to false on a primitive and I believe that will not be taken into account for any pickPosition calls. If you try that out and it works for you (by using labels through the primitive API instead of the entity API) I think it would be a great to expose this via the Entity API.