Utility Layer Renderer not compatible with Action Manager

Hi, I am trying to start an Action on a mesh used within a utility layer renderer. But the Action is not firing. It works, if I place the box in the following playground within the main scene and do not use it as custom mesh.
(I think the setCustomMesh/Gizmo has nothing to do with it)

Its a bug, isnt it? :confused:

I also observed, that utilityLayer.processAllEvents = true seems to only track events, happening on the gizmo. So if I move the gizmo and my mouse moves outside the gizmo because its faster, then the gizmo wont follow. This is not what I would expect from processAllEvents? Revised: (the reason the gizmo is not moving with mouse outside of it, is onlyCheckPointerDownEvents set to false. and although i thought this would allow all events, it actually relates to what kind of events are passed through to the underlying scene. so it should be true.)

cc @Evgeni_Popov if he has an idea ?

Calling attachControl() on the utility layer scene makes it work for me, but I don’t know if it’s the right way to do it…

Maybe @Cedric will know?

havent thought about it!

but looking into the code, it seems it is not wanted:

I also have to revise my second post: the reason the gizmo is not moving with mouse outside of it, is onlyCheckPointerDownEvents set to false. and although i thought this would allow all events, it actually relates to what kind of events are passed through to the underlying scene. so it should be true.

I guess there is also a reason, why PointerTap is not used by default?

going to dig a bit deeper

reason why i am asking about actionManager: i wanted to create a hover effect

now what is interesting, a PointerEventTypes.POINTERMOVE only catches meshes that have an actionManager. (https://playground.babylonjs.com/#WMHYD8#4)
But this is not the case in utilityLayerRenderer. Since it does not use an ActionManager, it catches all meshes on pointer move. This is also how gizmos are highlighted.
Now I could easily create a hover effect via

    utilLayer.utilityLayerScene.onPointerObservable.add(e=>{
        if(e.pickInfo.pickedMesh===box){
            box.scaling = new BABYLON.Vector3(1,1,1).scale(1.2)
        }else{
            box.scaling = new BABYLON.Vector3(1,1,1)
        }
    })

However this won´t call a nice animation. OnPointerOverTrigger und OnPointerOutTrigger would be nicer. Maybe I will just get along with this one.

One thing @Cedric might still be able to answer is the reason for missing POINTERTAP event if processAllEvents === false. But I could get around it via processAllEvents set to true.

Anyways. I am happy to have the utility layer renderer and do not need to implement it myself :smiley: working on a drawing tool…

1 Like

I’m not very familiar with this code/inputs. Maybe @PolygonalSun knows something?

As far as I understand, the UtilityLayerRenderer overlays normally gizmos onto the scene and scales them relative to screen. The utility scene handles its own pointer events, to allow selecting of the gizmos, since otherwise a gizmo within a pickable mesh could not be clicked. And the utility scene also handles clicking to the original scene, if nothing is picked within its scene. It is therefore kind of a pointer mask. Every pointer event on a gizmo within utility scene is handled within utility scene, and if its pointer movement, it will also be recognised if mouse it outside of gizmo while moving.
These cases probably make it difficult to use the standard pointer events of normal scene. Most probably no action manager has been implemented for utility scene, too.

I am ok now with my little code snippet above and avoid action manager. So no need to summon more maintainers :slight_smile:

If someone else is in need, please “reopen” :slight_smile:

Thanks for your help!