Pointer up Event fire twice in WebXR(ar) mode

@RaananW I know you might be the right guy to ask, I am working on an AR project which needs to use some pointer events to select meshes. I’ve set up the WebXR scene following WebXR Experience Helpers | Babylon.js Documentation with WebXRExperienceHelper (and I am using the basic one, not the default one). added the features like POINTER_SELECTION and init the xrInput class. The problem for me is the pointer up event seems triggered twice with a single tap on my phone, the pointer down seems only triggered once. I am not sure if that’s a bug, I tried both scene.onPointerUp and scene.onPointerObservable.add(async (pointerInfo) => {(different pointerInfo.type here)} returns me the same result.

Also, another one I noticed is that the event fired but seems to return all 0 inside it. Like if you try onPointerMove events, it will always trigger even it’s just a single tap and the movementX and movementY are all 0.(so there is no way for me to check if it is a drag move event or tap event) I wonder if there is something special with webXR camera because I can get the normal return event with a normal camera setting.

I wonder if there is something else I should have used for pointer selection and init the ray, I do found this WebXR Controllers Support | Babylon.js Documentation but I am not sure how to init the xrInputSource with the basic XR helper setting. I do see you said you Init the input source class which will initialize controllers in the default experience but not sure how you did that.

Sorry for the long story here, hopefully not take too much of your time to read all through this. In all, I am trying to find the best way to do some gestures recognization in webXR on mobile(like single tap, hold and drag, two-finger rotate). Let me know if all the above is the right approach, any other suggestions are highly appreciated!

It sure feels like one!

Would you be able to reproduce this on the playground for me to test?


sure yeah, try this https://playground.babylonjs.com/#9K3MRA#633, you need to click on scene one time to enter webXR as it requires user interaction. I just put pointer up event here to test you can see it triggered twice every click and the event detail info are all 0

I only get a single point up on any device I checked on. There was an issue entering xr, but this is something else.

So you mean that when you press in the canvas area you see two pointer-up events in the console?

Hey, thanks for the reply but try clicking more times when you enter the XR, the first click is normal because the XR is not inited yet.

I am using Samsung Galaxy S20 testing and I always get it triggered twice.

I do notice something different from your screenshot, I get it triggered twice when I tap on my phone, as you see isTrusted is false and if you open the detail you will see the pointer type is ‘xr’. I do got it triggered normally once by clicking on the inspector with my mouse and the pointer type is ‘touch’

yep, i see it now. I wonder why I haven’t seen this behavior before. Will have to debug that tomorrow and get back to you.


Thanks for look into that, any update news about that?

Nope, not yet. But i’ll keep you updated here

Got it thank you very much! Do you have a time estimate on this?

Probably beginning of next week.

Following up - [XR] prevent a double pointerup event by RaananW · Pull Request #11494 · BabylonJS/Babylon.js (github.com)

PR submitted :slight_smile:


Awesome thanks for fixing that, is that also include the fix for the event detail? As I noticed in webXR mode all the event details are 0 like in scene.onPointerMove event.movementX and event.movementY

it will be included in the same version as the augmentation of screenX and screenY

Hi, @RaananW I am starting to get this pointer event trigger twice on one single tap bug again, see https://playground.babylonjs.com/#9K3MRA#633. I update the engine version to the latest 5.1.0 recently.

cc @RaananW in case he missed the first ping

I think there is a follow up thread now: WebXR Pointer up event trigger twice on one single touch - #15 by xtxz