How to use the aframe/src.THREE.Euler 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 / three / TransformControls.js View on Github external
const quaternionXYZ = new THREE.Quaternion();
  const quaternionX = new THREE.Quaternion();
  const quaternionY = new THREE.Quaternion();
  const quaternionZ = new THREE.Quaternion();
  const quaternionE = new THREE.Quaternion();

  const oldPosition = new THREE.Vector3();
  const oldScale = new THREE.Vector3();
  const oldRotationMatrix = new THREE.Matrix4();

  const parentRotationMatrix = new THREE.Matrix4();
  const parentScale = new THREE.Vector3();

  const worldPosition = new THREE.Vector3();
  const worldRotation = new THREE.Euler();
  const worldRotationMatrix = new THREE.Matrix4();
  const camPosition = new THREE.Vector3();
  const camRotation = new THREE.Euler();

  domElement.addEventListener('mousedown', onPointerDown, false);
  domElement.addEventListener('touchstart', onPointerDown, false);

  domElement.addEventListener('mousemove', onPointerHover, false);
  domElement.addEventListener('touchmove', onPointerHover, false);

  domElement.addEventListener('mousemove', onPointerMove, false);
  domElement.addEventListener('touchmove', onPointerMove, false);

  domElement.addEventListener('mouseup', onPointerUp, false);
  domElement.addEventListener('mouseout', onPointerUp, false);
  domElement.addEventListener('touchend', onPointerUp, false);
github kabbi / zanzarah-tools / src / three / TransformControls.js View on Github external
const quaternionY = new THREE.Quaternion();
  const quaternionZ = new THREE.Quaternion();
  const quaternionE = new THREE.Quaternion();

  const oldPosition = new THREE.Vector3();
  const oldScale = new THREE.Vector3();
  const oldRotationMatrix = new THREE.Matrix4();

  const parentRotationMatrix = new THREE.Matrix4();
  const parentScale = new THREE.Vector3();

  const worldPosition = new THREE.Vector3();
  const worldRotation = new THREE.Euler();
  const worldRotationMatrix = new THREE.Matrix4();
  const camPosition = new THREE.Vector3();
  const camRotation = new THREE.Euler();

  domElement.addEventListener('mousedown', onPointerDown, false);
  domElement.addEventListener('touchstart', onPointerDown, false);

  domElement.addEventListener('mousemove', onPointerHover, false);
  domElement.addEventListener('touchmove', onPointerHover, false);

  domElement.addEventListener('mousemove', onPointerMove, false);
  domElement.addEventListener('touchmove', onPointerMove, false);

  domElement.addEventListener('mouseup', onPointerUp, false);
  domElement.addEventListener('mouseout', onPointerUp, false);
  domElement.addEventListener('touchend', onPointerUp, false);
  domElement.addEventListener('touchcancel', onPointerUp, false);
  domElement.addEventListener('touchleave', onPointerUp, false);
github kabbi / zanzarah-tools / src / three / TransformControls.js View on Github external
this.update = function (rotation, eye2) {
    THREE.TransformGizmo.prototype.update.apply(this, arguments);

    const tempMatrix = new THREE.Matrix4();
    const worldRotation = new THREE.Euler(0, 0, 1);
    const tempQuaternion = new THREE.Quaternion();
    const unitX = new THREE.Vector3(1, 0, 0);
    const unitY = new THREE.Vector3(0, 1, 0);
    const unitZ = new THREE.Vector3(0, 0, 1);
    const quaternionX = new THREE.Quaternion();
    const quaternionY = new THREE.Quaternion();
    const quaternionZ = new THREE.Quaternion();
    const eye = eye2.clone();

    worldRotation.copy(this.planes.XY.rotation);
    tempQuaternion.setFromEuler(worldRotation);

    tempMatrix.makeRotationFromQuaternion(tempQuaternion).getInverse(tempMatrix);
    eye.applyMatrix4(tempMatrix);

    this.traverse(child => {
github kabbi / zanzarah-tools / src / three / TransformControls.js View on Github external
worldRotation.setFromRotationMatrix(tempMatrix.extractRotation(scope.object.matrixWorld));

    camera.updateMatrixWorld();
    camPosition.setFromMatrixPosition(camera.matrixWorld);
    camRotation.setFromRotationMatrix(tempMatrix.extractRotation(camera.matrixWorld));

    scale = worldPosition.distanceTo(camPosition) / 6 * scope.size;
    this.position.copy(worldPosition);
    this.scale.set(scale, scale, scale);

    eye.copy(camPosition).sub(worldPosition).normalize();

    if (scope.space === 'local' || _mode === 'scale') {
      _gizmo[_mode].update(worldRotation, eye);
    } else if (scope.space === 'world') {
      _gizmo[_mode].update(new THREE.Euler(), eye);
    }

    _gizmo[_mode].highlight(scope.axis);
  };