Scene picking on 'MeshBuilder.CreateGround'

Hello,

I just try to move a sphere on a ‘Ground’ thanks to scene.pick(…) .
This ground is just modfied with some random Y on vertex position.
All works fine, when camera is on top, but when we are looking the ground a bit more to the horizon, it seems some pickings event are ignored, most when when mouse is at opposite of the camera view. I must miss something or doing something wrong ?. Any idea ? Thks !
Playground : https://playground.babylonjs.com/#2GV6UU#19

1 Like

Hey there, it looks like the issue is that the bounding box is still flat (min and max y are both 0, like a plane). After calling refreshBoundingInfo() to rebuild the bounding box with the new height, then it seems to be working well. :slightly_smiling_face:
https://playground.babylonjs.com/#BP3DE5#5

Here is another playground version that shows the bounding box and makes the mesh green so you can see better what’s going on.
https://playground.babylonjs.com/#BP3DE5#7

And for completeness, here it is without refreshing the bounding box, so you can see how it was stopping early when it hit the edge of the flat bounding box.
https://playground.babylonjs.com/#BP3DE5#3

4 Likes

Awesome, Thanks !

1 Like

@Blake I love when I start my day reading your answers !!! I know it has nothing to do with this post but I had to say it :slight_smile:

1 Like