index.js
function createHitEntity (data) {
  var cylinder;
  var hitEntity;
  var torus;

  // Parent.
  hitEntity = document.createElement('a-entity');
  hitEntity.className = 'hitEntity';

  // Torus.
  torus = document.createElement('a-entity');
  torus.setAttribute('geometry', {
    primitive: 'torus',
    radius: data.hitCylinderRadius,
    radiusTubular: 0.01
  });
  torus.setAttribute('rotation', {x: 90, y: 0, z: 0});
  torus.setAttribute('material', {
    shader: 'flat',
    color: data.hitCylinderColor,
    side: 'double',
    depthTest: false
  });
  hitEntity.appendChild(torus);

  // Cylinder.
  cylinder = document.createElement('a-entity');
  cylinder.setAttribute('position', {x: 0, y: data.hitCylinderHeight / 2, z: 0});
  cylinder.setAttribute('geometry', {
    primitive: 'cylinder',
    segmentsHeight: 1,
    radius: data.hitCylinderRadius,
    height: data.hitCylinderHeight,
    openEnded: true
  });
  cylinder.setAttribute('material', {
    shader: 'flat',
    color: data.hitCylinderColor,
    side: 'double',
    src: cylinderTexture,
    transparent: true,
    depthTest: false
  });
  hitEntity.appendChild(cylinder);

  return hitEntity;
}
function createHitEntity (data) {
  var cylinder;
  var hitEntity;
  var torus;

  // Parent.
  hitEntity = document.createElement('a-entity');
  hitEntity.className = 'hitEntity';

  // Torus.
  torus = document.createElement('a-entity');
  torus.setAttribute('geometry', {
    primitive: 'torus',
    radius: data.hitCylinderRadius,
    radiusTubular: 0.01
  });
  torus.setAttribute('rotation', {x: 90, y: 0, z: 0});
  torus.setAttribute('material', {
    shader: 'flat',
    color: data.hitCylinderColor,
    side: 'double',
    depthTest: false
  });
  hitEntity.appendChild(torus);

  // Cylinder.
  cylinder = document.createElement('a-entity');
  cylinder.setAttribute('position', {x: 0, y: data.hitCylinderHeight / 2, z: 0});
  cylinder.setAttribute('geometry', {
    primitive: 'cylinder',
    segmentsHeight: 1,
    radius: data.hitCylinderRadius,
    height: data.hitCylinderHeight,
    openEnded: true
  });
  cylinder.setAttribute('material', {
    shader: 'flat',
    color: data.hitCylinderColor,
    side: 'double',
    src: cylinderTexture,
    transparent: true,
    depthTest: false
  });
  hitEntity.appendChild(cylinder);

  return hitEntity;
}
function createHitEntity ( data ) { var cylinder ; var hitEntity ; var torus ; // Parent. hitEntity = document . createElement ( 'a-entity' ) ; hitEntity . className = 'hitEntity' ; // Torus. torus = document . createElement ( 'a-entity' ) ; torus . setAttribute ( 'geometry' , { primitive : 'torus' , radius : data . hitCylinderRadius , radiusTubular : 0.01 } ) ; torus . setAttribute ( 'rotation' , { x : 90 , y : 0 , z : 0 } ) ; torus . setAttribute ( 'material' , { shader : 'flat' , color : data . hitCylinderColor , side : 'double' , depthTest : false } ) ; hitEntity . appendChild ( torus ) ; // Cylinder. cylinder = document . createElement ( 'a-entity' ) ; cylinder . setAttribute ( 'position' , { x : 0 , y : data . hitCylinderHeight / 2 , z : 0 } ) ; cylinder . setAttribute ( 'geometry' , { primitive : 'cylinder' , segmentsHeight : 1 , radius : data . hitCylinderRadius , height : data . hitCylinderHeight , openEnded : true } ) ; cylinder . setAttribute ( 'material' , { shader : 'flat' , color : data . hitCylinderColor , side : 'double' , src : cylinderTexture , transparent : true , depthTest : false } ) ; hitEntity . appendChild ( cylinder ) ; return hitEntity ; }
Create mesh to represent the area of intersection.
Default to a combination of torus and cylinder.
Create mesh to represent the area of intersection . Default to a combination of torus and cylinder .