Jump to content

Basic GearVR controller support and WiFi debugging


brianzinn
 Share

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 192.168.1.77
connected to 192.168.1.77:5555

C:\Program Files (x86)\Android\android-sdk\platform-tools>adb devices
List of devices attached
192.168.1.77:5555       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 http://127.0.0.1:3000 (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 #192.168.1.65:5555
com.sec.android.app.sbrowser.beta
[ ] 'Title of page' http://127.0.0.1:3000
<inspect>
Chrome
...
com.brave.browser
...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...