Simple use of utilitylayer and gizmo throws notifyObservers errors

I am trying to create a sample for another bug I stumbled on this one.
This simple PG sample Babylon.js Playground throws error (in console) “n.utilityLayerScene.onPointerObservable.notifyObservers is not a function”
Why?
—bjorn

It looks like pointer move events are observed but not poniter down/up. Any idea @PolygonalSun ?

I’m seeing the same thing. Let me dig in a bit more and see what’s happening.

1 Like

So, here’s what I’ve found. Pointer Down/Up do work when clicking on any present gizmos. If there’s no gizmos on screen, the down and up will never fire because there’s nothing to click on. Basically, all clicks are ignored on the utility layer, unless you’re clicking on something that is active on that layer. I’m not sure if that’s how the UtilityLayerRenderer is supposed to work but that’s what I’ve found.

For the provided PG to work, you would need to add your observer/callback to the main scene’s onPointerObservable rather than the UtilityLayerRenderer’s scene. I’ve made a new version of the PG ( Spotlight Not Blocked By Mesh | Babylon.js Playground (babylonjs.com)) to show what I think is what you were originally trying to do (if I’m wrong, please let me know). What do you think, @Cedric?

Thank you for clearing this issue @PolygonalSun I want to keep it as it’s supposed to work.

1 Like

@PolygonalSun , thanks, the project I’m working on is using meshes in the utility layer so can’t really use the real scene. What I am trying to do is to attach (on pointer down) the gizmo to a mesh in the utility layer and then have the gizmo start dragging but the gizmo doesn’t seem to get the pointer move events. (https://playground.babylonjs.com/#XHXWAW#4)