We encounter a bug related to the recently added feature of LazyPicking in v5.29.0 and its interaction with sprites.
Here is a minimal playground that reproduce the problem: https://playground.babylonjs.com/#EVYLLB#8
constantlyUpdateMeshUnderPointer = true on a scene, we expect to be able to constantly get picking info on meshes when attaching a callback to the
onPointerObservable of the scene. It does work until we add a
SpriteManager to the scene.
SpriteManger is added to the scene, picking info contains null information when hovering meshes and while mouse is down. It gets information only on mouse click events.
We suspect that it comes from the recently added feature of lazy picking, where the picking info is not necessarily filled automatically in
scene.inputManager.ts::_onPointerMove() (line 794) but rather at the call of the getter.
Later in the InputManager._processPointerMove() method, a for loop iterates though elements only related to sprites. If there is at least one
SpriteManager, The loop will fill information about picking info preventing a future call to the getter to compute new information. Sadly, this loop fill null information to the picking info .
Hopefully we found a workaround to the problem but it consists on suppressing the lazy picking. We basically add a
DoNothingAction to the scene on hover:
scene.actionManager = new BABYLON.ActionManager(scene);
// Note that we use a mesh trigger on the scene ...
That way, at
scene.inputManager.ts::_onPointerMove() (line 794), there is an action registered and we force the picking.
Finally we think that the lazy picking does not really work with the interaction of sprites. I personally don’t know the code well enough to propose a fix for that
That’s all for the post,
Thanks for the reading,
Have a good day !