toji / webgl-quake3

WebGL Quake 3 level renderer
http://media.tojicode.com/q3bsp
265 stars 62 forks source link

WebXR wont work on iOS #18

Open ivnnv opened 4 years ago

ivnnv commented 4 years ago

Hi @toji, I have tried to do my best to document and report a bug on the webxr polyfill that causes iOS not to be able to use WebXR on this demo (Im trying to make a working q3 cardboard gameplay 😬)

I have seen you had previously contributed to both the examples and the polyfill repos, so maybe this is something you could be able to fix or point me in the right direction to make the view to attach to the device movement:

I made a workaround adding the above on main.js->initEvents():

window.addEventListener('deviceorientation', (event) => {
  const yPos = isXRPresenting() ? event.gamma : event.beta;
  moveLook(-event.alpha * 10, -yPos * 10);
});

which initially "works more or less", but need to figure out how properly transform event's alpha, beta, gamma values to moveLook parameters.

Thanks in advance. Best.