Mouse picking issue

mouse picking issue | Babylon.js Playground (babylonjs.com)

In the example, the cursor is expected to be placed somewhere at the surface of the mesh where your mouse pointed on.
When you move the mouse up, sometimes you may see the cursor moving vertically up which means it’s not positioned on the mesh, it’s floating. It also outputs blank mesh name in console while it’s happening.
This happens whether it’s mesh created by MeshBuilder or mesh imported from GLTF file. How to prevent this? What is it actually picking?

When you don’t move the mouse, the picking function returns the mesh cursor. You should exclude it from picking:

2 Likes

That’s true, I think I was stupid…