# WebXR no point events on Android?

**URL:** <https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460>\
**Category:** Bugs\
**Created:** [August 31, 2021, 10:11am UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460 "2021-08-31T10:11:08Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 10:11am UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/1 "2021-08-31T10:11:08Z")

</div>

Clicking in the screen works ok on PC and Android devices, but when the XR session starts any click using the PC and a WebXR emulator is properly readed and printed into the label but it doesn’t log any touch on android, without that I cannot find how to interact with WebXR and Android (Google glasses and so)

As always the mandatory sample [https://playground.babylonjs.com/#F41V6N#457](https://playground.babylonjs.com/#F41V6N#457)

Thank you in advance.

---

<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:** [August 31, 2021, 12:51pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/2 "2021-08-31T12:51:08Z")

</div>

that is because, AFAIK, android doesn’t support touch events on the canvas when in XR. (But I might be mistaken). There is already an issue to track that - [WebXR simple pointer support for touch/select events when in gaze mode · Issue #10186 · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/issues/10186)

What are you using to test? cardboard-style device?

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 2:18pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/3 "2021-08-31T14:18:35Z")

</div>

I’ve tried it with a cardboard style glasses and just clicking on the screen itself (also with quest 2 but it works perfectly there)

It doesn’t seem to be a technology limitation since for example this one [WebXR UI Interaction - PLAYCANVAS](https://playcanv.as/p/TAYVQgU2/) works flawlessly.

---

<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:** [August 31, 2021, 2:32pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/4 "2021-08-31T14:32:55Z")

</div>

I assume you only need the click effect. You will not try to actually select a mesh when in a cardboard scene, i assume.

Is gaze mode activated? can you see the gaze point? are you only looking for a way to trigger the pointer down/up events?

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 3:12pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/5 "2021-08-31T15:12:46Z")

</div>

The weird thing is that window.onclick is not triggered either [https://playground.babylonjs.com/#F41V6N#460](https://playground.babylonjs.com/#F41V6N#460)

_I assume you only need the click effect._  
Yes.

_You will not try to actually select a mesh when in a cardboard scene, i assume._  
I need it but I can make a raycast from the center of the screen to select them.

_Is gaze mode activated?_  
Yes, without that mode it gets the trigger without problems

_can you see the gaze point?_  
You mean the white dot? If so, yes.

_Are you only looking for a way to trigger the pointer down/up events?_  
Exactly.

Btw the webxr in my Android seems to be laterally offset I mean I can see the “two views” and a white line that I imagine that should be between both but it is not.

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 3:13pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/6 "2021-08-31T15:13:45Z")

</div>

System OnePlus 8T + Chrome.

 ![Screenshot_20210831-171210](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/b/4b4341cf987b958ba08f88b86d5fe3cb03899449.jpeg)

---

<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:** [August 31, 2021, 3:38pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/7 "2021-08-31T15:38:05Z")

</div>

> [@Escobar](#):
>
> The weird thing is that window.onclick is not triggered either [https://playground.babylonjs.com/#F41V6N#460](https://playground.babylonjs.com/#F41V6N#460)

That’s my point.

If clicking on the canvas triggers an input-source creation, than it is already supported.  
I assume that the canvas does trigger the select event (xrSession select), and this would be the way for you to get the click from the canvas.

Try doing this:

```auto
xrSessionManager.session.addEventListener("selectstart", () => { console.log('clicked') });

```

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 4:23pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/8 "2021-08-31T16:23:50Z")

</div>

> [@Escobar](#):
>
> [https://playground.babylonjs.com/#F41V6N#460](https://playground.babylonjs.com/#F41V6N#460)

It works but only once (probably my bad) [https://playground.babylonjs.com/#F41V6N#468](https://playground.babylonjs.com/#F41V6N#468)

---

<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:** [August 31, 2021, 4:27pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/9 "2021-08-31T16:27:41Z")

</div>

Only once you mean that it only triggers once? from your code it is hard to tell, as you change it to the same text every time you click.  
This event is a native webxr event, if must be triggered every time a selection was made. what “selection” means is different from one system to the other. In the oculus quest it is a tap of the fingers or click on the controller’s main component. on mobile devices it is a canvas touch.

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 4:28pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/10 "2021-08-31T16:28:51Z")

</div>

I mean that if I exit the WebXR mode and enter again it doesn’t work until I reload the page.

---

<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:** [August 31, 2021, 4:38pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/11 "2021-08-31T16:38:57Z")

</div>

Try using the sessionManager’s onSessionInitObservable. You won’t need the flag. You can also remove the event listener in onSessionEnded to stay callback-clean 🙂

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 5:07pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/12 "2021-08-31T17:07:00Z")

</div>

That’s weird even the simpler sample (not my own sample but the original one) is not longer working on PC [Babylon.js Playground](https://playground.babylonjs.com/#F41V6N)

```auto
VM177:1284 TypeError: Cannot read property 'textures' of null
    at e._createRenderTargetTexture (babylon.js:16)
    at Object.getRenderTargetForEye (babylon.js:16)
    at e.getRenderTargetTextureForEye (babylon.js:16)
    at babylon.js:16
    at Array.forEach (<anonymous>)
    at t._updateFromXRSession (babylon.js:16)
    at r.callback (babylon.js:16)
    at e.notifyObservers (babylon.js:16)
    at Object.renderFunction [as callback] (babylon.js:16)
    at XRSession$1.<computed>.onDeviceFrame (<anonymous>:1281:42)

```

Something broken on preview headers?

---

<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:** [August 31, 2021, 5:29pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/13 "2021-08-31T17:29:23Z")

</div>

Yes, working on that. latest build has an issue with XR init.

---

<div class="post-metadata">

**Author:** ![Escobar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/escobar/32/2726_2.png) [@Escobar](https://forum.babylonjs.com/u/Escobar)\
**Post date:** [August 31, 2021, 5:42pm UTC](https://forum.babylonjs.com/t/webxr-no-point-events-on-android/23460/14 "2021-08-31T17:42:22Z")

</div>

Thank you!
