On mobile or small screens, mesh is too small to pick with touch

Hi,

I found a perfectly good answer to this a few months ago, but Ive spent half an hour googling for it, and have found nothing.

I have a scene which contains content. When someone clicks (touches / taps) the scene on one of the meshes, information about that mesh is shown.

On a mobile the meshes are quite small, and it is difficult to get a touch on the mesh first time, so it takes a bunch of taps to actually hit the mesh.

I have two questions here.

  1. the first one is that it is clear that it is possible to make a hit box or otherwise larger bounding area such that it is easier to tap on the object represented by the mesh. I know there is some kind of documentation about this, but I cannot find it, googling on this subject.

  2. There appears to be absolutely nothing at all on “finding the closest mesh to a picking ray, when there are zero hits”. I can think of several ways to do this, but I imagine this must be an incredibly common problem, and Im wondering if I am using the wrong words to google.

luvs and light, thanks in advance for any help

Hello!

I didn’t find documentation about hitboxes either, but it’s probably something nice to have! Maybe as part of a Golden Path @syntheticmagus @PirateJC ?

However I created a simple example here: Hitbox | Babylon.js Playground (babylonjs.com) Would this be what you want?

3 Likes

Thank you very much. That does very nicely.

I found documentation for this 6 months ago, now I cannot find it anywhere

thank you again

1 Like