ActionManager performance leak

Hey guys,

I’m new to babylon.js (4.1) so this question might be stupid.
As soon as I’ve created an ActionManager for my Mesh, the performance of my app went south.
On mouse move over the canvas, the frame rate would drop to 0 without even registering an action.
Chrome’s Profiling tool shows that “SubMesh._intersectTriangles” takes a lot of time.
Commenting the ground.actionManager = new ActionManager(this.scene); fixes the issue.

Thanks,
Irinel

Hello and welcome!

This is probably expected if your mesh is complicated. When there is an action manager on a mesh, the system will cast rays to do picking to see if you are hovering your mesh for instance.

Depending on the Action Trigger, I would recommend either setting the mesh.isPickable = false or use a simplified version of your mesh for the Action manager

Maybe reproducing the issue in the Playground could help us give you more hints

I only have one ground Mesh on the screen with GridMaterial on it.
https://www.babylonjs-playground.com/#QFMAYA
If you comment out
ground.actionManager = new BABYLON.ActionManager(scene);
the framerate goes back to normal

Your ground has 2millions faces:)

Same experience, big optimization:

https://www.babylonjs-playground.com/#QFMAYA#1

3 Likes

Thanks a lot.
I didn’t understand what divisions is used for so i thought it should match the grid