src/components/vive-controls.js
function (evt) {
    var button = this.mapping.buttons[evt.detail.id];
    var buttonMeshes = this.buttonMeshes;
    var analogValue;

    if (!button) { return; }

    if (button === 'trigger') {
      analogValue = evt.detail.state.value;
      // Update trigger rotation depending on button value.
      if (buttonMeshes && buttonMeshes.trigger) {
        buttonMeshes.trigger.rotation.x = -analogValue * (Math.PI / 12);
      }
    }

    // Pass along changed event with button state, using button mapping for convenience.
    this.el.emit(button + 'changed', evt.detail.state);
  }
function (evt) {
    var button = this.mapping.buttons[evt.detail.id];
    var buttonMeshes = this.buttonMeshes;
    var analogValue;

    if (!button) { return; }

    if (button === 'trigger') {
      analogValue = evt.detail.state.value;
      // Update trigger rotation depending on button value.
      if (buttonMeshes && buttonMeshes.trigger) {
        buttonMeshes.trigger.rotation.x = -analogValue * (Math.PI / 12);
      }
    }

    // Pass along changed event with button state, using button mapping for convenience.
    this.el.emit(button + 'changed', evt.detail.state);
  }
function ( evt ) { var button = this . mapping . buttons [ evt . detail . id ] ; var buttonMeshes = this . buttonMeshes ; var analogValue ; if ( ! button ) { return ; } if ( button === 'trigger' ) { analogValue = evt . detail . state . value ; // Update trigger rotation depending on button value. if ( buttonMeshes && buttonMeshes . trigger ) { buttonMeshes . trigger . rotation . x = - analogValue * ( Math . PI / 12 ) ; } } // Pass along changed event with button state, using button mapping for convenience. this . el . emit ( button + 'changed' , evt . detail . state ) ; }
Rotate the trigger button based on how hard the trigger is pressed.
Rotate the trigger button based on how hard the trigger is pressed .