Input_hmd.js - Failed to recalculate device parameters

Hi,
Whenever I try to run a VR app using the WebVR plugin on a desktop computer without any VR hardware attached I get the following error

Failed to recalculate device parameters.console.error @ launch.js:6930

I wondered if there was any way around it as now and again it’s useful to test code without the VR hardware attached.

example project with the problem

https://playcanvas.com/project/415622/overview/htc-vive-boilerplate

If you set a break point in your developer tools on that line, and then track the error stack, you’ll find out where error originates from.
In fact this is not an error, but just console.error log, which shall not break anything. So your app still works and you can add whatever logic to control your camera when there is no hmd available.

I tried to use


    this.app.on("vr:missing", function () {
        console.log('vr is missing');
        Camera.setPosition(0,1.6,4);
    });

but it doesn’t appear that “vr:missing” in the plugin is firing even though I don’t have a HMD plugged into the PC, however “vr:ready” is firing ?

This error comes from the WebVR polyfill that we use to help support devices that don’t yet have full WebVR support. I haven’t looked into it in detail but I guess it’s trying to work out what your VR headset is and can’t figure it out because there is none attached.

Aside from showing a message on the screen, the error shouldn’t prevent anything from running.

You can also force VR enabled on all devices (even without the headset attached) in input_hmd.js there is a config at the bottom of the file.

WebVRConfig = {
  // Forces availability of VR mode, even for non-mobile devices.
  FORCE_ENABLE_VR: false, // Default: false.
  MOUSE_KEYBOARD_CONTROLS_DISABLED: true
};

Hi Dave,
It’s not stopping anything from running, I just wanted a reliable way of detecting that a real HMD was connected so that if it wasn’t I could set the camera up.

Let me expand. In order for the room scale tracking to start up in the right place I normally put the camera at 0,0,0 . This is fine for the Vive but for the desktop it makes it hard to see the scene and what’s happening.

If I do it the other way around and set the camera to a specific position suitable for a desktop then when connected to a Vive the position of centre of the room scale moves to the camera position which is not ideal either.

So basically I need someway of detecting if room scale is in operation or not and set the camera appropriately.

Hi Dave,
You can mark this as solved.

I am going to put the camera where I want while developing. And then in my startup script I am going to check

navigator.getVRDisplays()[0].displayName

to find out which device is in operation and if it’s a vive set the position of the camera to (0,0,0) which should take care of my problem.

Scratch that, didn’t work. It looks like as long as the vrCamera script is running on a desktop computer it positions the camera at 0,0,0 and pointing straight down.

Oh well :slight_smile: