I have a short question about how Babylon handles pointermove and scene picking / raycast. Take a look at the image below:
It seems that there is some background logic going on, since when I keep wiggling my mouse I can lower my performance quite a lot. I do have a lot of meshes in my scene, but I also do set them as not pickable in the scene when they are further away from the camera/player.
So what is the deal here? This can be produced easily when going into any playground, for example: https://playground.babylonjs.com/#S7E00P#52
and using the chrome performance tool… Can someone clarify why the mousemove is being processed continuously and with the scene.pick?
This is done by the system to see if some meshes are pickable and need to trigger their actions (onPointerMove).
This is the predicate used to select if a mesh needs an action:
Babylon.js/scene.inputManager.ts at master · BabylonJS/Babylon.js (github.com)
So if you have a lot of meshes in your scene the system will go through all of them on every pointer move.
I will introduce an option on the scene to skip that feature entirely if you do not need it
Wow that was fast! Thank you Deltakosh!
Just a clarification, will I be able to use
DeviceSourceManager normally? How about if I manually add an
ActionManager to the mesh, will I be able to add, for example,
ActionManager.OnPointerOverTrigger ExecuteCodeActions if I have
scene.skipPointerMovePicking = true?
Nope cause in this case you will need to run the pointer move function
For the action manager you mean? Or for also
For the actionManager, the rest should be fine as it is done before.
I decided not to create a new topic on the forum. I’m sorry if this is wrong. I can’t access the scene.skipPointerMovePicking property.
I use TypeScript + ESLint.
SceneLoader, CubeTexture, Matrix,
} from '@babylonjs/core'
this.scene = new Scene(engine)
this.scene.skipPointerMovePicking = true
TS2339: Property ‘skipPointerMovePicking’ does not exist on type ‘Scene’.
Other properties and methods work fine.
Is there a workaround? I will be glad of any help.
this method would be on the beta 5.0 not 4.2