scene.pickWithRay cannot pick ground mesh

I am having trouble getting a ray to pick a point on the ground mesh, so I made this test playground here: https://playground.babylonjs.com/#LQ4LI1#156

Am I initializing this ray incorrectly? Or is scene.pickWithRay not able to get the ground mesh? The pickingInfo is always null.

Hi kyroryo,

I think you’re just trying to pick a little too quickly. Sometimes, especially when creating 3D objects, things don’t fully finish happening exactly when you call them, so attempting to use them may not work until a frame or two later. In your case, you are creating the ground mesh and trying to pick from it in the same frame, so I think the ground mesh just isn’t quite finished initializing itself yet. If you do the picking a little later, it works as expected.

Hope this helps, and best of luck!

I see, still new to all of this so this helps a bunch! Should solve some of my other problems too, thank you very much!