cleanCachedTextureBuffer() and ArcRotateCamera errors

Hello all!

My application depends heavily on dynamically adding/disposing elements, along with clearing cached data. I’m currently trying to run scene.clearCachedVertexData(); after an array of meshes have been disposed, but afterwards when I try panning my scene camera (an ArcRotateCamera), there seems to be some internal raycasting/picking happening with scene objects, which throws an error. Is there anyway to avoid camera related raycasting/picking?


Hello, I’m not sure to understand :slight_smile:
Can you share a repro in the PG?

to have a mesh invisible to picking, you can simply mesh.isPickable = false

Hey @Deltakosh, while building a repro I solved the issue, haha. I was already setting the isPickable property to false for the meshes being built dynamically, but there was plane underneath all of those meshes that was still pickable and causing the error (which has been changed and everything is working fine now) – but this leads me to my next question: if deleting vertex data for a mesh causes errors when raycasting/picking, then can I exclude said mesh from the clearCachedVertexData() method? Also, if I’m not doing any picking in my code, then why is it happening in the background? Is it related to how the ArcRotateCamera moves and tilts? Or is it fired when there’s a _onPointerUp event? Here’s the error code from the previous build:

Uncaught TypeError: i is undefined

This is why we ask people for repro :wink:

1 Like

It seems you are using ActionManager? seems like the culprit who launches the pick

1 Like

Yep, I typed “ActionManager” in Visual Studio Code’s search window, and it appears all over my project’s compiled JavaScript, but not my TypeScript… odd. Most of it must be code imported from @Babylon/core, but I wonder how much of it is injected into my scripts because of Webpack? Down the rabbit-hole I gooooooo!

If you are not CREATING one it is maybe not the culprit
can you share your code somewhere?

Sadly, not at the moment :pensive:. But I appreciate your help!