# Pointer up Event fire twice in WebXR(ar) mode

**URL:** <https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030>\
**Category:** Bugs\
**Tags:** webxr\
**Created:** [November 5, 2021, 6:13pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030 "2021-11-05T18:13:43Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 5, 2021, 6:13pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/1 "2021-11-05T18:13:43Z")

</div>

Hi,  
@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](https://doc.babylonjs.com/divingDeeper/webXR/webXRExperienceHelpers) 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](https://doc.babylonjs.com/divingDeeper/webXR/webXRInputControllerSupport) 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!

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 8, 2021, 1:23pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/2 "2021-11-08T13:23:49Z")

</div>

> [@xtxz](#):
>
> I am not sure if that’s a bug

It sure feels like one!

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

---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 8, 2021, 3:46pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/3 "2021-11-08T15:46:40Z")

</div>

sure yeah, try this [https://playground.babylonjs.com/#9K3MRA#633](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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 8, 2021, 4:42pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/4 "2021-11-08T16:42:41Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/4/f4126b8b459763c6088cee33c0a59b66107fde53.png)

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

---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 8, 2021, 5:43pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/5 "2021-11-08T17:43:50Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/a/6a4dd4a2ee4796cd0dcff346ab9712ded5894546.png)

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’

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 8, 2021, 7:47pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/6 "2021-11-08T19:47:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 8, 2021, 7:47pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/7 "2021-11-08T19:47:19Z")

</div>



---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 12, 2021, 7:39pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/8 "2021-11-12T19:39:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 15, 2021, 11:14am UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/9 "2021-11-15T11:14:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 16, 2021, 3:21pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/10 "2021-11-16T15:21:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 18, 2021, 3:22pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/11 "2021-11-18T15:22:23Z")

</div>

Probably beginning of next week.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 19, 2021, 3:18pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/12 "2021-11-19T15:18:01Z")

</div>

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

PR submitted 🙂

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 19, 2021, 3:18pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/13 "2021-11-19T15:18:03Z")

</div>



---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [November 19, 2021, 5:52pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/14 "2021-11-19T17:52:47Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [November 19, 2021, 6:05pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/15 "2021-11-19T18:05:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xtxz](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/xtxz/32/19604_2.png) [@xtxz](https://forum.babylonjs.com/u/xtxz)\
**Post date:** [April 12, 2022, 3:39pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/16 "2022-04-12T15:39:20Z")

</div>

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](https://playground.babylonjs.com/#9K3MRA#633). I update the engine version to the latest 5.1.0 recently.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [May 12, 2022, 1:35pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/17 "2022-05-12T13:35:41Z")

</div>

cc @RaananW in case he missed the first ping

---

<div class="post-metadata">

**Author:** ![br-matt](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/br-matt/32/22436_2.png) [@br-matt](https://forum.babylonjs.com/u/br-matt)\
**Post date:** [May 12, 2022, 1:40pm UTC](https://forum.babylonjs.com/t/pointer-up-event-fire-twice-in-webxr-ar-mode/25030/18 "2022-05-12T13:40:53Z")

</div>

I think there is a follow up thread now: [WebXR Pointer up event trigger twice on one single touch - #15 by xtxz](https://forum.babylonjs.com/t/webxr-pointer-up-event-trigger-twice-on-one-single-touch/29370/15)
