Skip to content

Commit

Permalink
Merge pull request #338 from vincentfretin/disable-look-controls
Browse files Browse the repository at this point in the history
[orbit-controls] Disable look-controls and wasd-controls in init if present
  • Loading branch information
dmarcos authored Jan 9, 2024
2 parents e663c77 + 636099d commit 5452a5e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions components/orbit-controls/dist/aframe-orbit-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,12 @@ AFRAME.registerComponent('orbit-controls', {
this.target = new THREE.Vector3();
this.cursor = new THREE.Vector3();
el.getObject3D('camera').position.copy(this.data.initialPosition);
if (el.hasAttribute('look-controls')) {
el.setAttribute('look-controls', 'enabled', false);
}
if (el.hasAttribute('wasd-controls')) {
el.setAttribute('wasd-controls', 'enabled', false);
}
},

pause: function () {
Expand Down Expand Up @@ -1662,6 +1668,12 @@ AFRAME.registerComponent('orbit-controls', {
remove: function() {
this.controls.reset();
this.controls.dispose();
if (this.el.hasAttribute('look-controls')) {
this.el.setAttribute('look-controls', 'enabled', true);
}
if (this.el.hasAttribute('wasd-controls')) {
this.el.setAttribute('wasd-controls', 'enabled', true);
}

this.el.sceneEl.removeEventListener('enter-vr', this.onEnterVR);
this.el.sceneEl.removeEventListener('exit-vr', this.onExitVR);
Expand Down
Loading

0 comments on commit 5452a5e

Please sign in to comment.