WebXR Pointer up event trigger twice on one single touch

Oh yesssss you are right I copied something more than I should there so that you see the error. But that’s not related to the problem posted here. I made a better repo you might want to try out here https://playground.babylonjs.com/#9K3MRA#832. So previously you see everything fine at the beginning because you haven’t gone into the WebXR mode, the pointer up event was firing correctly if you were not in the WebXR mode. Then after the first click when you initialize the WebXR you will notice the problem happens. you can try my latest playground above I’ve clean up the code a bit so that no more errors and can see the camera view.

I’ll address this issue very soon.
@PolygonalSun - this happens because we emulate pointer up both when a controller is detached and in AR there are two of them. PR is coming later today :slight_smile:

That was quick :slight_smile:

2 Likes

@RaananW that fix seems do prevent it from firing two pointer events but it seems the right pointerEvent was removed? I can no longer select the mesh in the scene when I am in WebXR mode. see the playground demo here https://playground.babylonjs.com/#9K3MRA#839

@PolygonalSun @RaananW any thoughts on this?

sorry, I totally missed that. i’ll check that and will let you know! thanks

thanks! let me know how it goes

Have you had a chance to look at this one yet @RaananW ? :pray:

Doing it right now, actually

Will be merged and updated very soon

2 Likes

Thanks!

@RaananW Hi, is it possible that the issue has come back ? I am facing it in my AR project, and I managed to repoduce it here : Test double pointer up XR | Babylon.js Playground (babylonjs.com)

When in the AR session, every tap results in 1 down event and 2 up events. This happens whether with scene.onPointerDown/scene.onPointerUp callbacks or with scene.onPointerObservable.add(…).

There is a difference with @xtxz’s repro, I don’t do all the “complex” xr initialization. I’m only relying on scene.createDefaultXRExperienceAsync(), but I am not sure this has something to do with the issue.

will look into that! Should, of course, not have happened, but everything is possible.

This is happening because near interaction is now enabled per default, and it was triggering a pointer up when a controller was detached. This PR will fix it:

[XR] Only trigger near pointer up if down was triggered by RaananW · Pull Request #14860 · BabylonJS/Babylon.js (github.com)

A side note - checking the type of the pointer up will make it safer when processing pointer events. the default type in XR is “xr”, whereas near interaction events have the type xr-near , so you can differentiate between the two.

1 Like

Thank you for the side note :pray:

Thank you, as well, for taking care of this issue. Could you quickly explain what ‘near interaction’ means? Although I’m guessing it has something to do with direct interaction between controllers and 3D objects/GUI, I wasn’t able to find a complete explanation.

Exactly that :slight_smile:
The difference between ray picking and “touching”. objects. makes a little less sense when in mobile AR, as it is only being helpful when using controllers/hands in immersive mode.

1 Like