aframevr / aframe

:a: Web framework for building virtual reality experiences.
https://aframe.io/
MIT License
16.68k stars 3.98k forks source link

look-controls seem to no longer work with 0.7.0 but did with 0.6.1 #3190

Closed cloud4every1 closed 6 years ago

cloud4every1 commented 7 years ago

After downloading the latest version of Aframe, look-controls is no longer working. When using version 0.6.1 and earlier, everything works fine.

Based on a simple diff between the two versions shows some changes in the look-controls.js file regarding Rotation calculation.

Maybe you can let me know what I have to change (setting properties or similar) to get the basic functionality back.

many thanks

cloud4every1 commented 7 years ago

Tracing the console output of the device shows that with the original 0.6.1. aframe-master.js (working version) a warning + error + waring was thrown: aframe-master.js:63176 No DPDB device match. aframe-master.js:63111 Failed to recalculate device parameters. aframe-master.js:61110 Using fallback Android device measurements.

Corresponding functions: Dpdb.prototype.calcDeviceParams Dpdb.prototype.recalculateDeviceParams DeviceInfo.prototype.determineDevice_

In the latest 0.7.0 version, this is no longer the case - no error and no warning. I also recompiled the 0.6.1 version myself (npm run dist) and now even with this new version I do get the same behaviour as with 0.7.0. So it looks like this error/warning have been fixed there already but was not in the aframe-master.js

This part of the code seems no longer be executed with 0.7.0 (and also the recompile).

cloud4every1 commented 7 years ago

More tests did show that navigator.getVRDisplays() does not return any thing in the newer versions while in 0.6.1 master it returns a CardboardVRDisplay. Array(1) 0 : CardboardVRDisplay bufferScale_ : 1 cardboardUI_ : null deviceInfo_ : DeviceInfo displayName : "Cardboard VRDisplay (webvr-polyfill)" distorter_ : null dpdb_ : Dpdb poseSensor_ : FusionPoseSensor viewerSelector_ : ViewerSelector __proto__ : VRDisplay

What can be the reason for this?

dmarcos commented 7 years ago

Does the webvr-polyfill example work for you? https://github.com/googlevr/webvr-polyfill/tree/master/examples

cloud4every1 commented 7 years ago

Hi, I took a copy of the repository and tried to run it locally but I only receive a black screen with the menu on the top right (Fullscreen | VR(WebVR/Mobile only) | Reset). No errors in the console during the initial load.

I also tried the mentioned examples in the Readme.md file "https://webvr.info/samples/" but they all mention that no VR display can be found. I wonder what was overwriting the navigator.getDisplays() function as it works with 0.6.1 and do not with later versions?

dmarcos commented 7 years ago

@cloud4every1 the webvr-polyfill is the one doing all the work in browsers that don't have a WebVR implementation. If the polyfill example work on your device they should work on A-Frame.

cloud4every1 commented 7 years ago

Thanks a lot for your response! Question is why was it working in older versions? Did A-Frame not use Webvr-polyfill? How, where and on which criteria does webvr-polyfill check if a device is supported? Three.js deviceorientation examples are working fine on the device, so shouldn't this than be de-coupled anyway from the Display? In the older version it was recognized as CardboardVRDisplay. Is this not/no longer supported in webvr-polyfill? many thanks!

dmarcos commented 7 years ago

@cloud4every1 we were using the polyfill but we bumped the version we use. I would bet that it's a regression in the polyfill. You can try older versions of the polyfill by changing the package.json and running npm install and see if it fixes the issue: https://github.com/aframevr/aframe/blob/master/package.json#L46

cloud4every1 commented 7 years ago

Many, many thanks for your advice. This solved at least my issue. Changed aframe-master/package.json file, dependencies from "webvr-polyfill": "^0.9.36" to "webvr-polyfill": "0.9.36" and generated a new js file (npm run dist) - and it works again. This proofs that version 0.9.40 (which was used due to the compatibility marker) is eliminating several devices. This is maybe also the solution for #3087. How to proceed with this? should we open an issue on webvr-polyfill for this? Thanks!!

dmarcos commented 7 years ago

@cloud4every1 yes, please open an issue on the polyfill or open a PR if you know how to fix it. Thanks!

siva3378 commented 6 years ago

This issue still exists in aframe@0.8.2 & webvr-polyfill@0.10.5. Any ideas/suggestions how to fix this?

dmarcos commented 6 years ago

@siva3378 Can you describe the problem you have? What device are you using? What browser an version? Can you provide an example to reproduce?

siva3378 commented 6 years ago

When I add a single entity (just a box) with a camera of look-controls, as per docs, on mouse drag, entity should get rotated but the camera is rotating & view angle is getting changed.

Device: Google Chrome is up to date, Version 68.0.3435.0 (Official Build) canary (64-bit) I'm trying to host the example. I will revert with the link very soon

dmarcos commented 6 years ago

@siva3378 is not any of the examples working for you? https://aframe.io/aframe/examples/boilerplate/hello-world/

You can host your example on glitch if you prefer: https://glitch.com/~aframe

siva3378 commented 6 years ago

Thanks for your reply. So, here is my glitch which is very basic one. If you look at the HTML, the camera entity has got only look-controls. So as per docs mentioned here, on mouse drag, the box entity should get rotated, instead, camera angle is moving. May I know how to make the box-entity rotate?

I remember this use to happen before.

  <a-scene>
        <a-entity position="0 0 5">
          <a-entity camera look-controls></a-entity>
        </a-entity>
  <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
  <a-sky color="#ECECEC"></a-sky>
</a-scene>
dmarcos commented 6 years ago

@siva3378 The behavior is correct. As mentioned in the docs look-controls rotates the entity that is applied on: the camera in your case. You can apply it to your a-box. It will work in 2D mode but not in VR because the head tracking will be applied to it. look-controls is designed to be used with a camera.

<a-scene>
  <a-entity position="0 0 5">
    <a-entity camera></a-entity>
   </a-entity>
   <a-box look-controls position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9" shadow></a-box>
   <a-sky color="#ECECEC"></a-sky>
</a-scene>
siva3378 commented 6 years ago

oh now I understood. Appologies to bother you & thanks a ton.