# WebVR "grab" playground example doesn't work on Oculus Quest

**URL:** <https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233>\
**Category:** Questions\
**Created:** [September 17, 2020, 2:04am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233 "2020-09-17T02:04:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![owen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/owen/32/9325_2.png) [@owen](https://forum.babylonjs.com/u/owen)\
**Post date:** [September 17, 2020, 2:04am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/1 "2020-09-17T02:04:45Z")

</div>

Hi there, I’m trying to figure out how to virtually “grab” and “throw” an object in VR.

There is this guide at webvr\_helper#grab: [Use the WebVR experience helper - Babylon.js Documentation](https://doc.babylonjs.com/how_to/webvr_helper#grab)

But that playground example ([Babylon.js Playground](https://www.babylonjs-playground.com/#B4C2AH)) doesn’t work for me on Oculus Quest. The grabbing gesture doesn’t pick up the cubes.

I figured it was because the example is using the older webVR api and I need to update the playground example to WebXR api, however I’m having trouble finding an XR equivalent for the onNewMeshSelected observable, where can I find that?:

```
VRHelper.onNewMeshSelected.add(function(mesh) {
  selectedMesh = mesh;
});

VRHelper.onSelectedMeshUnselected.add(function() {
  selectedMesh = null;
});

```

Or is there a different suggested technique for getting an array of meshes (or mesh names) that my controller hand is near or intersecting?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 17, 2020, 8:14am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/2 "2020-09-17T08:14:28Z")

</div>

Might be a question for our WebXR master @RaananW

---

<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:** [September 17, 2020, 11:00am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/3 "2020-09-17T11:00:50Z")

</div>

Hi @owen,

WebXR in babylon works very similar to the way a mouse click would work if you use the default xr helper (and its pointer-selection feature) - pointer events are emulated when using the main component of your controller (the trigger button). `scene.onPointerDown` will work the same on desktop and in VR, and so will pointerUp and pointerMove.

---

<div class="post-metadata">

**Author:** ![owen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/owen/32/9325_2.png) [@owen](https://forum.babylonjs.com/u/owen)\
**Post date:** [September 18, 2020, 7:44am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/4 "2020-09-18T07:44:37Z")

</div>

I didn’t know about onPointerDown, thanks. I’m trying to play with it now but I’m not sure what I’m doing wrong: I tried assigning scene.onPointerDown to a function like so, to see what it returns:

```
 scene.onPointerDown = (pointEvent, pickInfo, pointerEventTypes) => {
          //added some logging here
        }

```

I can get the callback to log some output when the trigger button is held down. However, after I use teleport once I no longer get log output despite squeezing the trigger. Am I setting this up wrong? Did the callback get removed?

Second question, I think the main trigger button is the wrong thing I want to observe for a “grab” gesture. Shouldn’t I want to observe the grip squeeze button (under middle finger) instead? And determine what eligible mesh is closest to the controller? For example to stack a small set of blocks on a table I just want to grip and let go of any block without first “picking” any block with a trigger button.

Are there any XR examples / playground that work for Oculus quest that have solved this stack blocks/throw blocks feature?

---

<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:** [September 18, 2020, 8:43am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/5 "2020-09-18T08:43:19Z")

</div>

You can read all about controller interaction here - [WebXR Input and Controller support - Babylon.js Documentation](https://doc.babylonjs.com/how_to/webxr_controllers_support)

Try using our observers system instead of using direct function definitions - `scene.onPointerObservable` is your friend, as described here - [Interact with a Scene - Babylon.js Documentation](https://doc.babylonjs.com/how_to/interactions#pointer-interactions) . This works only with the trigger. the other parts of the controller will need to be dealt with using webxr obsvables (the link i sent before). The physcis playground in the examples ([https://playground.babylonjs.com/#B922X8#19](https://playground.babylonjs.com/#B922X8#19)) shows the way to deal with controller interaction (specifically squeeze) from around line 180.

I hope this helps! if anything is not clear, let us know

---

<div class="post-metadata">

**Author:** ![owen](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/owen/32/9325_2.png) [@owen](https://forum.babylonjs.com/u/owen)\
**Post date:** [September 19, 2020, 8:03am UTC](https://forum.babylonjs.com/t/webvr-grab-playground-example-doesnt-work-on-oculus-quest/14233/6 "2020-09-19T08:03:33Z")

</div>

Thank you! I’ll study your playground example. Great stuff btw!
