How do you update GPUPick meshes list?

Hi,

I can’t update the GPUPick meshes list, when I do so I get errors regarding instances, material or _internalMeshDataInfo being undefined. The PG below creates a new sphere after 1 sec.

Playground: Babylon.js Playground

Updated PG: using an array copy of scene.meshes based on:Passing scene.meshes to GPUPicker.setPickingList will clear them when GPUPicker.dispose - #4 by kzhsw

But still can’t update the list.

The problem seems to be with scene.onNewMeshAddedObservable whenever the code for the GPUPicker is there it fails. How can I update the GPUGPicker list after a new mesh is created?

I tried checking with onReady() and setting the param to true as well, no luck

Just give to the picker one frame to be ready after the observable is raised - https://playground.babylonjs.com/#YU2IJ5#14

2 Likes

Thank you, this does it. Wish there was a more explicit way of doing this but it works

Perplexity: It seems that you are encountering a problem with the GPU Picker in Babylon.js. Based on the search results and the latest information from the Babylon.js forum, we should make some adjustments. Here is a revised approach:

gpu picker

1 Like

Example with one extra observer - https://playground.babylonjs.com/#YU2IJ5#15

1 Like

Is there an attribute of gpuPicker that gives me back the point that was hit or do I have to use a ray?

gpu picker | Babylon.js Playground

Not yet, but there are some discussions with working PGs available: Get Picked Position from GPU Pick Discussion

Also this one: GPU picking point and normal example - #35 by xiehangyun

1 Like