im using samsung galaxy s4 with the latest version of chrome and the webVR is enabled and i am getting this error DOMException: Presentation request was denied. Im pretty stuck for ideas you can try it here Begining project it works fine in the browser but I cant get into VR mode on my android device using cardboard. on chrome canary when i enter VR its just flashing lights . any help is appreciated thank you
Unrelated question: How did you attach the sword to the camera? I would be extremely grateful if you paste a snippet of this!
Thanks in advance and sorry for the inconvenience.
@Kaizeras 3dHelper.js
import * as THREE from 'three';
export function get3DPoint(camera,x,y){
var mousePosition = new THREE.Vector3(x, y, 0.5);
mousePosition.unproject(camera);
var dir = mousePosition.sub(camera.position).normalize();
dir.y = dir.y + 0.05;
return dir;
}
then in client.js
import {get3DPoint} from '../3DHelper.js'
and in the render function
var swordvec = get3DPoint(vr.player.camera,0.2,0);
//console.log(swordvec);
vr.rootView.context.callFunction('RCTDeviceEventEmitter', 'emit', ['coordinate', [swordvec]]);
then in index.vr.j
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
and in my constructor i did this
````
RCTDeviceEventEmitter.addListener(
'coordinate',
(e) => { var vec = e[0];
this.swordCamera1 = [vec.x,vec.y,vec.z];
},
);
````
but the whole thing i was looking for a way with VRHeadModel because with the emulator when i move the VR device the sword doesnt move with it, i dont know whats the deal
When do you get the error? Does it appear when you first load the page, or when you press the Enter VR button?
Which version of Chrome for Android are you running? (major, minor, build. You can get this from Settings > about).
Which version of React VR are you using? What are the package versions on ovrui and react-vr-web?
@andrewimm when i press the EnterVR button chrome version 59.0.3071.125 and how do you get package versions?
You can get the version numbers by running npm list react-vr-web and npm list ovrui.
Also, you will find that attaching something to the camera via React isn't very efficient. It requires passing data from the runtime to React, then back to the client to position the object, causing this to lag ~2 frames behind reality.
It's much better to actually attach the Three.js object to the Camera object, relatively positioned. That way, it intercepts all of the inputs.
For now, this requires some orchestration in client.js (remove the Model from the React side, and then create the appropriate Object3D on the runtime side). The next major release of React VR will give you the opportunity to mount multiple React trees to a scene, making it easy to attach Models, heads-up displays, etc to things like the camera.
@andrewimm
[email protected]
[email protected]
I can reproduce, seems to be a recent change to Chrome 59, since previous versions worked fine. I'll continue to investigate.
@andrewimm thanks keep me posted, im just doing this as R&D for the company i work for. im guessing that we are going to eventually put it into production. thanks again
Fwiw, it's a chrome bug, not a React VR issue.
I think it's related to this bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=719013
This wasn't present in previous version of 59, and cannot be reproduced in 60, 61, or beyond. According to that thread, it should have been included in a previous build of the same major-minor version we're both running, but there's a chance that it didn't make it out. I'll try to follow up with some of the Chromium team to pinpoint.
@andrewimm do you have to host webVR apps on HTTPS because i get this popup in chrome 59 that says the site is not secure when i enterVR. Is there a way you can do it on HTTP
To avoid the popup on Chrome, you do need to host on https. This is a security concern from the Chrome team.
I made changes to the React Native codebase to support custom https certs in the bundling server we use to serve up your code locally. The next major version of React VR will include these changes, which will allow you to create self-signed certs to bypass this when running on localhost.
Also, the popup should eventually disappear if you wait.
Either way, it will not prevent the "enter vr" button from working. It only warns users that they are in an unsecured environment.
re-open if more is required
Most helpful comment
@Kaizeras 3dHelper.js
then in client.js
import {get3DPoint} from '../3DHelper.js'and in the render function
var swordvec = get3DPoint(vr.player.camera,0.2,0); //console.log(swordvec); vr.rootView.context.callFunction('RCTDeviceEventEmitter', 'emit', ['coordinate', [swordvec]]);then in index.vr.j
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');and in my constructor i did this
````
RCTDeviceEventEmitter.addListener(
'coordinate',
(e) => { var vec = e[0];
},
);
````
but the whole thing i was looking for a way with VRHeadModel because with the emulator when i move the VR device the sword doesnt move with it, i dont know whats the deal