diff --git a/herosaver.js b/herosaver.js index b226bb4..2ccc9ba 100644 --- a/herosaver.js +++ b/herosaver.js @@ -148,7 +148,20 @@ function init() { } for (var k = 0; k < 4; k++) { + + if (mesh.geometry.morphTargets !== 'undefined') { + var tempVector = new THREE.Vector4(morphVector.x, morphVector.y, morphVector.z); + } else { + var tempVector = new THREE.Vector4(vector.x, vector.y, vector.z); + } + + tempVector.multiplyScalar(weights[k]); + //the inverse takes the vector into local bone space + //which is then transformed to the appropriate world space + tempVector.applyMatrix4(inverses[k]).applyMatrix4(skinMatrices[k]); + finalVector.add(tempVector); + /* var tempVector = new THREE.Vector4(vector.x, vector.y, vector.z); tempVector.multiplyScalar(weights[k]); //the inverse takes the vector into local bone space @@ -156,7 +169,7 @@ function init() { //which is then transformed to the appropriate world space .applyMatrix4(skinMatrices[k]); finalVector.add(tempVector); - +*/ } output += '\t\t\tvertex ' + finalVector.x + ' ' + finalVector.y + ' ' + finalVector.z + '\n';