Can Sprites not be picked when it is obscured by the mesh?

Can you please tell me how to make sprites unpickable when they are obscured by the mesh?

20230816_17255320238161727281

Sprites Examples | Babylon.js Playground (babylonjs.com)

I think you’ll need to make an additional call to scene.pick and check the value of pickResult.distance: if that of scene.pick is smaller than that of scene.pickSprite, then the sprite is obscured.

Thank you. Like this.

Sprites Examples | Babylon.js Playground (babylonjs.com)

1 Like

Yes!

You can simplify the code a little if you want:

1 Like

Thank you.