src/components/hand-controls.js
function (previousHand) {
    var controlConfiguration;
    var el = this.el;
    var hand = this.data;
    var self = this;

    // Get common configuration to abstract different vendor controls.
    controlConfiguration = {
      hand: hand,
      model: false,
      orientationOffset: {x: 0, y: 0, z: hand === 'left' ? 90 : -90}
    };

    // Set model.
    if (hand !== previousHand) {
      this.loader.load(MODEL_URLS[hand], function (gltf) {
        var mesh = gltf.scene.children[0];
        mesh.mixer = new THREE.AnimationMixer(mesh);
        self.clips = gltf.animations;
        el.setObject3D('mesh', mesh);
        mesh.position.set(0, 0, 0);
        mesh.rotation.set(0, 0, 0);
        el.setAttribute('vive-controls', controlConfiguration);
        el.setAttribute('oculus-touch-controls', controlConfiguration);
        el.setAttribute('windows-motion-controls', controlConfiguration);
      });
    }
  }
function (previousHand) {
    var controlConfiguration;
    var el = this.el;
    var hand = this.data;
    var self = this;

    // Get common configuration to abstract different vendor controls.
    controlConfiguration = {
      hand: hand,
      model: false,
      orientationOffset: {x: 0, y: 0, z: hand === 'left' ? 90 : -90}
    };

    // Set model.
    if (hand !== previousHand) {
      this.loader.load(MODEL_URLS[hand], function (gltf) {
        var mesh = gltf.scene.children[0];
        mesh.mixer = new THREE.AnimationMixer(mesh);
        self.clips = gltf.animations;
        el.setObject3D('mesh', mesh);
        mesh.position.set(0, 0, 0);
        mesh.rotation.set(0, 0, 0);
        el.setAttribute('vive-controls', controlConfiguration);
        el.setAttribute('oculus-touch-controls', controlConfiguration);
        el.setAttribute('windows-motion-controls', controlConfiguration);
      });
    }
  }
function ( previousHand ) { var controlConfiguration ; var el = this . el ; var hand = this . data ; var self = this ; // Get common configuration to abstract different vendor controls. controlConfiguration = { hand : hand , model : false , orientationOffset : { x : 0 , y : 0 , z : hand === 'left' ? 90 : - 90 } } ; // Set model. if ( hand !== previousHand ) { this . loader . load ( MODEL_URLS [ hand ] , function ( gltf ) { var mesh = gltf . scene . children [ 0 ] ; mesh . mixer = new THREE . AnimationMixer ( mesh ) ; self . clips = gltf . animations ; el . setObject3D ( 'mesh' , mesh ) ; mesh . position . set ( 0 , 0 , 0 ) ; mesh . rotation . set ( 0 , 0 , 0 ) ; el . setAttribute ( 'vive-controls' , controlConfiguration ) ; el . setAttribute ( 'oculus-touch-controls' , controlConfiguration ) ; el . setAttribute ( 'windows-motion-controls' , controlConfiguration ) ; } ) ; } }
Update handler. More like the `init` handler since the only property is the hand, and
that won't be changing much.
Update handler . More like the init handler since the only property is the hand and that won t be changing much .