Skip to content

Instantly share code, notes, and snippets.

@nickjanssen
Created October 1, 2015 11:14
Show Gist options
  • Save nickjanssen/8f7cb1dac5f8a7cd8488 to your computer and use it in GitHub Desktop.
Save nickjanssen/8f7cb1dac5f8a7cd8488 to your computer and use it in GitHub Desktop.
mesh.traverseAncestors(function (parent) {
parent.updateMatrixWorld(true);
})
var worldScale = mesh.getWorldScale();
var worldRotation = mesh.getWorldQuaternion();
var boxWidth: json.userData.size[0] * worldScale.x;
var boxHeight: json.userData.size[1] * worldScale.y;
var boxDepth: json.userData.size[2] * worldScale.z;
var offset: (new THREE.Vector3()).fromArray(json.userData.center)
.multiply(worldScale)
.applyQuaternion(worldRotation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment