Skip to content

Commit

Permalink
only set this.controls.userHeight if device has positional tracking (…
Browse files Browse the repository at this point in the history
…refs #3051)
  • Loading branch information
vincentfretin committed Oct 2, 2017
1 parent 30ca3e3 commit 4da8fe4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/look-controls.js
Original file line number Diff line number Diff line change
@@ -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');

var checkHasPositionalTracking = utils.device.checkHasPositionalTracking;

// To avoid recalculation at every mouse movement tick
var GRABBING_CLASS = 'a-grabbing';
var PI_2 = Math.PI / 2;
Expand Down Expand Up @@ -56,9 +59,12 @@ module.exports.Component = registerComponent('look-controls', {

tick: function (t) {
var data = this.data;
var hasPositionalTracking = this.hasPositionalTracking !== undefined ? this.hasPositionalTracking : checkHasPositionalTracking();
if (!data.enabled) { return; }
this.controls.standing = data.standing;
this.controls.userHeight = this.getUserHeight();
if (hasPositionalTracking) {
this.controls.userHeight = this.getUserHeight();
}
this.controls.update();
this.updateOrientation();
this.updatePosition();
Expand Down

0 comments on commit 4da8fe4

Please sign in to comment.