Trying to fix sprite picking when covering mesh

There is a counterintuitive behavior when picking a sprite which covering a pickable mesh.The mesh will always be picked though it’s behind the sprite.
I’m trying to fix this problem and it’s now behaviors like blow:

I have not finished it yet (had just dealt with the pointerDown event, not including pointerUp pointerMover or others, and there must be other related effects I have to handle).

The keypoint is that I’m new to Babylon.js source code and I had go through codes only related to mesh/sprite picking and action triggering.
Here is the modification I have made:

Appreciate if anyone pointing out anything I have to handle or watch out.

Your change in the InputManager class would be a breaking change, so it would not be possible to make it in the official repo…

This post gives a workaround for it:

2 Likes

Well… things not that simple, prepared to hear that. Check the distance manually works well. But maybe threre is a non-invasion way to fix this problem entirely? I don’t know. Maybe I will trying to figure out.

1 Like