Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only set this.controls.userHeight if device has positional tracking #3111

Closed

Conversation

vincentfretin
Copy link
Contributor

@vincentfretin vincentfretin commented Oct 2, 2017

This definitely fix issue #3051
I don't know how to write a test for this, this seems bound to the VRControls and how it renders in the browser...

@dmarcos
Copy link
Member

dmarcos commented Oct 2, 2017

The proper solution for this is probably moving the logic to the restore pose of the camera component: https://github.com/aframevr/aframe/blob/master/src/components/camera.js#L99

@vincentfretin
Copy link
Contributor Author

@dmarcos There is already a hasPositionalTracking check in camera to save the pose (position and rotation of the camera) yes. So you mean saving userHeight? But this is set on the VRControls object, not the camera. I'm really lost with this, and I don't have any positional tracking device to test this, only GearVR.

What I know it that before #3000, there was no this.controls.userHeight = this.getUserHeight(); line in look-controls, so the this.controls.userHeight stayed at 0.0. Adding a condition to it solved the issue for GearVR.

@machenmusik
Copy link
Contributor

It feels to me as though we are trying to bake too many smarts into the camera -- when it comes to uses for render textures and spectator views, the camera is just that - not meant to be a stand-in for the user and presumed HMD positioning. I thought that (in current incarnation) look-controls was intended to contain the latter, and that from prior discussions we thought this area might need some refactoring. My recollection is that recent changes have handed to use absolute positioning not relative positioning for room scale etc., and this repeated application of relative offset may be a vestige of doing things the old way that should not be re-introduced regardless of where?

@vincentfretin vincentfretin force-pushed the fix-increasing-offset branch from 24fa2aa to 4da8fe4 Compare October 2, 2017 16:49
@dmarcos
Copy link
Member

dmarcos commented Oct 3, 2017

All right. I think we should then move the logic to save / restore the camera pose / position from the camera to look-controls as well as the userHeight property.

@vincentfretin
Copy link
Contributor Author

One other thing that seems to differ between positional and non positional tracking devices is that with positional tracking you are placed to z -2 or something like that, and with GearVR you are probably at z: 0. So there are some examples, notably c-frame/aframe-super-hands-component#89 where you are too close to the object, here with the big cube.

@DavidWyand
Copy link

I just wanted to add that this fix works for me. It allows my project to work on GearVR with the Oculus browser, and the Vive using Firefox 56.0, without having to make any camera changes. Thanks!

@vincentfretin
Copy link
Contributor Author

@dmarcos Maybe we can merge this and you folks work eventually on a refactoring in another branch?

@ngokevin
Copy link
Member

@ngokevin
Copy link
Member

Fixed the tests.

@dmarcos this fix make sense? We can refactor later.

@olga-microsoft
Copy link
Contributor

@vincentfretin sorry for breaking GearVR and thank you for issuing the fix. I verified that it works as expected with Window Mixed Reality.

hasPositionalTracking = this.hasPositionalTracking !== undefined
? this.hasPositionalTracking
: checkHasPositionalTracking();
if (hasPositionalTracking) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to understand. How come we still want to apply user height if there is positional tracking? Seems to me you don't want to apply an offset if your height is tracked, or we should check more specifically that there are no stage parameters? And how come it was adding up more and more each time enter VR?

Copy link
Contributor

@cvan cvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good. thanks for this. let me know when you want another review. no rush. also, just so I know, which example(s) are you testing against? and on which platforms have you tested?

@@ -1,8 +1,11 @@
var registerComponent = require('../core/component').registerComponent;
var THREE = require('../lib/three');
var utils = require('../utils/');
var DEFAULT_CAMERA_HEIGHT = require('../constants').DEFAULT_CAMERA_HEIGHT;
var bind = require('../utils/bind');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to change this to utils.bind

var DEFAULT_CAMERA_HEIGHT = require('../constants').DEFAULT_CAMERA_HEIGHT;
var bind = require('../utils/bind');

var checkHasPositionalTracking = utils.device.checkHasPositionalTracking;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to import this function above?

this.controls.standing = data.standing;
this.controls.userHeight = this.getUserHeight();

hasPositionalTracking = this.hasPositionalTracking !== undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is already expect to be a Boolean, you can simplify this expression

requestAnimationFrame: function () { return 1; },
cancelAnimationFrame: function (h) { return window.cancelAnimationFrame(1); }
requestPresent: resolvePromise,
submitFrame: function () { return; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test for checking the tracking method and user height?

@dmarcos
Copy link
Member

dmarcos commented Oct 20, 2017

VRControls / VREffect will be soon gone. See #3152 I leave it open as a reference and a reminder to port the logic. Nothing to do here.

@dmarcos
Copy link
Member

dmarcos commented Dec 17, 2017

After the removal of VREffect / VRControls this PR is not applicable anymore.

@dmarcos dmarcos closed this Dec 17, 2017
@vincentfretin vincentfretin deleted the fix-increasing-offset branch April 15, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants