Skip to content
Snippets Groups Projects
Commit 0423267e authored by netpro2k's avatar netpro2k
Browse files

Fix inflating of entities with different rotation order from aframe

parent cdba3564
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,11 @@ const inflateEntities = function(classPrefix, parentEl, node) { ...@@ -81,6 +81,11 @@ const inflateEntities = function(classPrefix, parentEl, node) {
el.classList.add(classPrefix + className); el.classList.add(classPrefix + className);
parentEl.appendChild(el); parentEl.appendChild(el);
// AFRAME rotation component expects rotations in YXZ, convert it
if (node.rotation.order !== "YXZ") {
node.rotation.setFromQuaternion(node.quaternion, "YXZ");
}
// Copy over transform to the THREE.Group and reset the actual transform of the Object3D // Copy over transform to the THREE.Group and reset the actual transform of the Object3D
el.setAttribute("position", { el.setAttribute("position", {
x: node.position.x, x: node.position.x,
...@@ -98,9 +103,8 @@ const inflateEntities = function(classPrefix, parentEl, node) { ...@@ -98,9 +103,8 @@ const inflateEntities = function(classPrefix, parentEl, node) {
z: node.scale.z z: node.scale.z
}); });
node.position.set(0, 0, 0); node.matrixAutoUpdate = false;
node.rotation.set(0, 0, 0); node.matrix.identity();
node.scale.set(1, 1, 1);
el.setObject3D(node.type.toLowerCase(), node); el.setObject3D(node.type.toLowerCase(), node);
...@@ -118,7 +122,6 @@ const inflateEntities = function(classPrefix, parentEl, node) { ...@@ -118,7 +122,6 @@ const inflateEntities = function(classPrefix, parentEl, node) {
} }
const entityComponents = node.userData.components; const entityComponents = node.userData.components;
if (entityComponents) { if (entityComponents) {
for (const prop in entityComponents) { for (const prop in entityComponents) {
if (entityComponents.hasOwnProperty(prop)) { if (entityComponents.hasOwnProperty(prop)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment