How to use the aframe/src.THREE.Math function in aframe

To help you get started, we’ve selected a few aframe examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kabbi / zanzarah-tools / src / components / transformable.js View on Github external
this.controls.addEventListener('objectChange', () => {
      // Sync with components
      const { object3D } = this.el;
      this.el.setAttribute('position', object3D.position);
      this.el.setAttribute('rotation', object3D.rotation.toArray()
        .map(THREE.Math.radToDeg)
        .join(' ')
      );
    });
    sceneEl.object3D.add(this.controls);
github kabbi / zanzarah-tools / src / components / z-fo-model.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});
github kabbi / zanzarah-tools / src / components / z-trigger.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});
github kabbi / zanzarah-tools / src / components / z-model.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});
github kabbi / zanzarah-tools / src / components / z-model.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});
github kabbi / zanzarah-tools / src / components / z-fo-model.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});
github kabbi / zanzarah-tools / src / components / z-trigger.js View on Github external
handleComponentChanged(event) {
    const { name, newData } = event.detail;
    if (name === 'position') {
      const { x, y, z } = newData;
      this.el.setAttribute(this.attrName, 'position', [x, y, z]);
    }
    if (name === 'rotation') {
      const { y } = newData;
      const { rotation: oldRotation } = this.data;
      this.el.setAttribute(this.attrName, 'rotation', [
        Math.sin(THREE.Math.degToRad(y)), oldRotation[1],
        Math.cos(THREE.Math.degToRad(y)),
      ]);
    }
  },
});