index.js
function(){

    var self = this;

    var camera = self.el.sceneEl.camera;

    if(camera) {

        var camera_rotation = camera.el.getAttribute("rotation");

        var camera_yaw = camera_rotation.y;

        // Set position of menu based on camera yaw and data.pitch

        // Have to add 1.6m to camera.position.y (????)

        self.y_position = camera.position.y + 1.6;
        self.x_position = -self.data.distance * Math.sin(camera_yaw * Math.PI / 180.0);
        self.z_position = -self.data.distance * Math.cos(camera_yaw * Math.PI / 180.0);

        self.el.setAttribute("position", [self.x_position, self.y_position, self.z_position].join(" "));

        // and now, make our controls rotate towards origin

        this.el.object3D.lookAt(new THREE.Vector3(camera.position.x, camera.position.y + 1.6, camera.position.z));

    }

  }
function(){

    var self = this;

    var camera = self.el.sceneEl.camera;

    if(camera) {

        var camera_rotation = camera.el.getAttribute("rotation");

        var camera_yaw = camera_rotation.y;

        // Set position of menu based on camera yaw and data.pitch

        // Have to add 1.6m to camera.position.y (????)

        self.y_position = camera.position.y + 1.6;
        self.x_position = -self.data.distance * Math.sin(camera_yaw * Math.PI / 180.0);
        self.z_position = -self.data.distance * Math.cos(camera_yaw * Math.PI / 180.0);

        self.el.setAttribute("position", [self.x_position, self.y_position, self.z_position].join(" "));

        // and now, make our controls rotate towards origin

        this.el.object3D.lookAt(new THREE.Vector3(camera.position.x, camera.position.y + 1.6, camera.position.z));

    }

  }
function ( ) { var self = this ; var camera = self . el . sceneEl . camera ; if ( camera ) { var camera_rotation = camera . el . getAttribute ( "rotation" ) ; var camera_yaw = camera_rotation . y ; // Set position of menu based on camera yaw and data.pitch // Have to add 1.6m to camera.position.y (????) self . y_position = camera . position . y + 1.6 ; self . x_position = - self . data . distance * Math . sin ( camera_yaw * Math . PI / 180.0 ) ; self . z_position = - self . data . distance * Math . cos ( camera_yaw * Math . PI / 180.0 ) ; self . el . setAttribute ( "position" , [ self . x_position , self . y_position , self . z_position ] . join ( " " ) ) ; // and now, make our controls rotate towards origin this . el . object3D . lookAt ( new THREE . Vector3 ( camera . position . x , camera . position . y + 1.6 , camera . position . z ) ) ; } }
Puts the control in from of the camera, at this.data.distance, facing it...
Puts the control in from of the camera at this . data . distance facing it ...