Sign in to follow this  

Basic GearVR controller support and WiFi debugging

Recommended Posts

This post to help anybody that would like to debug/work on GearVR or other mobile devices over WiFi.  There is a pull request that was approved today.  The code to implement was literally 10 minutes of mostly copy/paste, while the setup took over an hour to figure out, so I wanted to share that (also for my forgetful self in the future!).

What does work on GearVR is trigger button will select meshes.  Trackpad allows you to rotate.  At least with trigger button working it is somewhat usable now!

The todo list at least contains:
- get a 3D model
- onTrackpadChangedObservable (doesn't exist, but would be called).  The trackpad axis could then show on mesh where it is selected (ie: small circle).
- position on GamePad is always null by design.  It should be held in the hand from the constructor, which I think defaults to 'right'. that will fix the rays coming from the eyes and have the model visible.  I think choose a position in front and model should align with the forward ray from that point.
- using the headset device control I was triggering scene pick events, but did not seem to be where I was looking.  So, support for GearVR headset (without a controller) needs yet to be added.

I just wanted to outline my workflow that allows you to debug your GearVR from Chrome on your desktop.  If you directly connect your device via USB with USB debugging you can already do this and most of us already do that.  With the GearVR, however, you will need to debug over WiFi as the USB connection on the GearVR headset is for charging only (and the GearVR headset uses the USB connection of your phone).

First you need to have adb (install the android SDK or download the platform-tools).
Step 1.  Connect your android device to USB and set the TCP port:

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
9889234230424e3755      device

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb tcpip 5555

Step 2.  Disconnect your android device from USB.  Ensure you are connected to the same WiFi network as your desktop.  Get your Phone IP address from Settings->About->Status (on S8).

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb connect
connected to

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb devices
List of devices attached       device

Note: You may need to reconnect your device during development, so probably leave this prompt open, so you can reconnect.

Open up chrome://inspect on your desktop - make sure you are on the Devices tab.  Click port forwarding to allow accessing ie: localhost:3000.
Open up Samsung Internet to (so, loopback address instead of 'localhost').

You should see the following under Remote Target in the lower part of the chrome://inspect tab:
SM-G950W #
[ ] 'Title of page'

Also, any other debuggable Chromium browsers running will show up (ie: Chrome, Brave, etc.).  Note that SM-G950W will be your phone model identifier followed by your phone WiFi IP address.

Clicking the inspect link (bold above) to open DevTools.  You can now simulate clicks on your phone in the emulator and view the console.  This is how you would, for example, see the button indexes to map to functionality you need.

If you are working on BabylonJS itself you can get away with only 'npm install' and 'gulp typescript' then symbolically link (or copy) the preview release with the node_modules in your project.  Otherwise you can use the local PG in BabylonJS.  I've tried both and they work well.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.