From 9420ecd626652f8076ba4177366f61f36f23945b Mon Sep 17 00:00:00 2001 From: SaiDAV <63246483+SaiDAV@users.noreply.github.com> Date: Mon, 6 Apr 2020 11:54:31 -0300 Subject: [PATCH] Try to correct faces. --- herosaver.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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';