Mesh Button 3D doesn't update onPointerOutObservable if only camera moves

Hello,
my Mesh Button 3D doesn’t update onPointerOutObservable if only the camera moves as seen here:

It only updates when the pointer is moved afterwards.
Is there a way to manually update or some other suggestion?

cc @DarraghBurke

Hey there, I am conferring with @RaananW on the correct solution for this. What we will probably end up doing is calling the ADT’s _doPicking from the camera’s onViewMatrixChange Observer. I’ll keep you posted on what we come up with!

2 Likes

Hey, just to give you a quick update, we have settled on a solution. I’ve opened an issue for this feature and will get it done this week: Feature request: fire pointerOut events on GUI controls when the camera moves · Issue #12027 · BabylonJS/Babylon.js (github.com)

2 Likes

PR is now open: [GUI] Add checkPointerEveryFrame property by darraghjburke · Pull Request #12056 · BabylonJS/Babylon.js (github.com)

This is still happening but shouldn’t, right? Babylon.js v5.0.0-rc.2

Sorry, I should have clarified: you need to set checkPointerEveryFrame on the advancedDynamicTexture to true.This is what will continuously check the pointer and update if it’s moved in or out of the control, even if the physical device hasn’t changed at all.

Hm, I’m not using an advancedDynamicTexture? I’m using a MeshButton3D…

Ah, so sorry, I read your original post too quickly and thought you were using 2D GUI! I didn’t realize you were using 3D GUI.

It should be pretty easy to add the same feature to 3D GUI, but we are coming up to the 5.0 release very shortly. It’s probably a little too late to get this in for 5.0.

Instead, I am working on a playground right now that will serve as a workaround to get this feature.

Later on we can add it to the library.

1 Like

Okay, here is the work-around I put together:

PointerMove WorkAround 3D GUI | Babylon.js Playground (babylonjs.com)

It’s the same concept: every frame, we trigger a fake pointermove event. This way if the pointer ever does enter or leave a control due to camera or mesh movements, an enter or exit event will fire.

2 Likes

@DarraghBurke you are the best

Thanks for the workaround. I’m going to wait for the simple bool though, as the remaining time on the project will probably be enough for you to add it. If not I know what to do!

2 Likes

FYI, I have opened an issue for this: [GUI] Add boolean to fire PointerMove events on 3D GUI elements every frame · Issue #12471 · BabylonJS/Babylon.js (github.com)

I’m not sure the core team will have time to implement this, which is why I’ve marked it as “Help Wanted” for now

2 Likes

Unfortunately I am leaving the Babylon team so I won’t have time to implement this feature, however this issue remains open and you are welcome to submit a PR for it if you are interested!

Thanks for mentioning!

For anyone wondering, I’m using the code in lines 42-48 from https://playground.babylonjs.com/#HJZBRG#245 to achieve the update.

I just changed pointerId to always be 1 and the observable to camera.onViewMatrixChangedObservable, that seems to work.
I also remove the observable once the pointer leaves the mesh button by checking the eventData:
if (!eventData.skipOnPointerObservable)

1 Like