Actions on meshes in utility layer are not triggered

Hi,

i am trying to put a mesh into utility layer and add some actions to it. I have created this playground which creates 2 boxes. One is added to the scene and the second one is added to the utility layer scene. Both have same actions registered, however actions registered on mesh in utility layer are not triggered. Also noticed that when i want to rotate camera and i start dragging at the mesh in utility layer then the camera doesn’t rotate.

I tried:

  • utilLayer.onlyCheckPointerDownEvents = false;
  • utilLayer.processAllEvents = true;

What am i missing?

This seems to be something with the action manager, as the onPointerObservable works as expected -

https://www.babylonjs-playground.com/#J19GYK#111

Checking :slight_smile:

2 Likes

Shouldn’t onPointerObservable emit on every pointer event (mouse move)? I updated the PG.

scene.onPointerObservable.add((event) => {
    console.log('PointerOnScene', event);
})

emits on every pointer event.

utilLayer.utilityLayerScene.onPointerObservable.add((event) => {
    console.log('PointerOnUtilityScene', event);
})

emits only when pointer is over mesh in utility layer.

It does emit for every event:

The types are different (4 - move, 1 - down, 32 - up)

Hm, i don’t have any PointerOnUtilityScene events when i don’t move my mouse over the mesh in utility layer.

:slight_smile:
I did nothing special except for clicking on it. What browser are you using?

I am on latest chrome. I was asking whether when you click anywhere but the mesh in utility layer, should utility layer receive pointer event? Try clicking on the mesh on the right (mesh not in utility scene), what event do you have? Do you have PointerOnUtilityScene? I don’t and that is the question. Why are not all pointer events propagated to utility layer scene. When the event happens on some mesh in utility layer only then it is emited for utility layer scene.

Found out that when i don’t set:
utilLayer.onlyCheckPointerDownEvents = false;
then both scenes receive every event.

However, this doesn’t solve the original problem of actions not being triggered.

1 Like

@RaananW
I was able to implement what i need, but it seems like i am re-implementing the Actions stuff. Here is updated PG. Would be much better when the actions worked for all scenes. I am currently digging in UtilityLayerRenderer. It detaches the events and handles events in custom way:

// Detach controls on utility scene, events will be fired by logic below to handle picking priority
this.utilityLayerScene.detachControl();

I am trying to understand whats going on in there.

@Deltakosh - any quick answer for that before I dig into the code?

What i understood from the code is that only InputManager and Scene calls ActionManager.processTrigger. So by detaching InputManager from the utility layer scene there is no one left to trigger action on mesh.

nope :frowning:

Still not working. I’ve posted a bug - BABYLON.ActionManager for mesh in utilityLayerScene not working