Clicking Meshes: _pickingUnavailable is true in PickingInfo result

Hello,

I’m trying to detect clicks on a mesh. Documentation is pretty straightforward but I don’t think I’m importing the necessary modules for it to work correctly. Here’s my simple code:

scene.onPointerDown = function(e, result) {
	console.log(result);
}

I get a PickingInfo in the console, but the _pickingUnavailable property is true. Searched that property in the babylonjs source and found this:

// Dummy info if picking as not been imported
const pi = new PickingInfo();
pi._pickingUnavailable = true;

So my best guess is I’m not importing something I should. What am I missing? Thanks.

EDIT: Looks like this does the trick. Although I wonder if I could import something more specific?

import "@babylonjs/core/Culling"

Nope you are right

Pinging @sebavan for doc update

From the documentation: ES6 - Babylon.js Documentation

  • Ray and Picking functions can be found in the Culling/ray module.

I do not think it is clear enough, I am literally taking any ideas to improve this part of the doc :slight_smile:

so importing “@babylonjs/core/Culling/ray” should be sufficient here.

1 Like

Thanks! I was looking at this page in the documentation:

https://doc.babylonjs.com/babylon101/picking_collisions

If you’re looking for suggestions, maybe doc pages can mention what modules are required for features explained on the page?

1 Like