diff --git a/mainview/framework.js b/mainview/framework.js index b35e48b..2619e15 100644 --- a/mainview/framework.js +++ b/mainview/framework.js @@ -13,54 +13,66 @@ var remote = null; var platform = "web"; var mixamorig = { - Hips: { - name: "mixamorigHips", - func: { fx: "-x", fy: "y", fz: "-z" }, + "Hips": { + "name": "mixamorigHips", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - Neck: { - name: "mixamorigNeck", - func: { fx: "-x", fy: "y", fz: "-z" }, + "Neck": { + "name": "mixamorigNeck", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - Chest: { - name: "mixamorigSpine2", - func: { fx: "-x", fy: "y", fz: "-z" }, + "Chest": { + "name": "mixamorigSpine2", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - Spine: { - name: "mixamorigSpine", - func: { fx: "-x", fy: "y", fz: "-z" }, + "Spine": { + "name": "mixamorigSpine", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - RightUpperArm: { - name: "mixamorigRightArm", - func: { fx: "-z", fy: "x", fz: "-y" }, + "RightUpperArm": { + "name": "mixamorigRightArm", + "order": "ZXY", + "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, - RightLowerArm: { - name: "mixamorigRightForeArm", - func: { fx: "-z", fy: "x", fz: "-y" }, + "RightLowerArm": { + "name": "mixamorigRightForeArm", + "order": "ZXY", + "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, - LeftUpperArm: { - name: "mixamorigLeftArm", - func: { fx: "z", fy: "-x", fz: "-y" }, + "LeftUpperArm": { + "name": "mixamorigLeftArm", + "order": "ZXY", + "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, - LeftLowerArm: { - name: "mixamorigLeftForeArm", - func: { fx: "z", fy: "-x", fz: "-y" }, + "LeftLowerArm": { + "name": "mixamorigLeftForeArm", + "order": "ZXY", + "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, - LeftUpperLeg: { - name: "mixamorigLeftUpLeg", - func: { fx: "-x", fy: "y", fz: "-z" }, + "LeftUpperLeg": { + "name": "mixamorigLeftUpLeg", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - LeftLowerLeg: { - name: "mixamorigLeftLeg", - func: { fx: "-x", fy: "y", fz: "-z" }, + "LeftLowerLeg": { + "name": "mixamorigLeftLeg", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, - RightUpperLeg: { - name: "mixamorigRightUpLeg", - func: { fx: "-x", fy: "y", fz: "-z" }, - }, - RightLowerLeg: { - name: "mixamorigRightLeg", - func: { fx: "-x", fy: "y", fz: "-z" }, + "RightUpperLeg": { + "name": "mixamorigRightUpLeg", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, + "RightLowerLeg": { + "name": "mixamorigRightLeg", + "order": "XYZ", + "func": { "fx": "-x", "fy": "y", "fz": "-z" } + } }; function domBoom(target, onfinish) { diff --git a/mocaprender/script.js b/mocaprender/script.js index 5ac6600..3af0a7c 100644 --- a/mocaprender/script.js +++ b/mocaprender/script.js @@ -305,16 +305,19 @@ const rigRotation = ( z: b.rotation.z, }; } - var bindingFunc = modelObj.binding[name].func; + const bindingFunc = modelObj.binding[name].func; + const order = modelObj.binding[name].order.toUpperCase(); const x = rotation.x * dampener; const y = rotation.y * dampener; const z = rotation.z * dampener; + // console.log("rotation.rotationOrder ",rotation.rotationOrder ) + let euler = new THREE.Euler( initRotation[name].x + eval(bindingFunc.fx), initRotation[name].y + eval(bindingFunc.fy), initRotation[name].z + eval(bindingFunc.fz), - rotation.rotationOrder || "XYZ" + order || rotation.rotationOrder || "XYZ" ); let quaternion = new THREE.Quaternion().setFromEuler(euler); b.quaternion.slerp(quaternion, lerpAmount); // interpolate diff --git a/models/models.json b/models/models.json index 57ec753..7c9ffba 100644 --- a/models/models.json +++ b/models/models.json @@ -152,50 +152,62 @@ "binding": { "Hips": { "name": "mixamorigHips", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Neck": { "name": "mixamorigNeck", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Chest": { "name": "mixamorigSpine2", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Spine": { "name": "mixamorigSpine", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightUpperArm": { "name": "mixamorigRightArm", + "order": "ZXY", "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, "RightLowerArm": { "name": "mixamorigRightForeArm", + "order": "ZXY", "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, "LeftUpperArm": { "name": "mixamorigLeftArm", + "order": "ZXY", "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, "LeftLowerArm": { "name": "mixamorigLeftForeArm", + "order": "ZXY", "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, "LeftUpperLeg": { "name": "mixamorigLeftUpLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "LeftLowerLeg": { "name": "mixamorigLeftLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightUpperLeg": { "name": "mixamorigRightUpLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightLowerLeg": { "name": "mixamorigRightLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } } } @@ -210,50 +222,62 @@ "binding": { "Hips": { "name": "mixamorigHips", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Neck": { "name": "mixamorigNeck", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Chest": { "name": "mixamorigSpine2", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "Spine": { "name": "mixamorigSpine", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightUpperArm": { "name": "mixamorigRightArm", + "order": "ZXY", "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, "RightLowerArm": { "name": "mixamorigRightForeArm", + "order": "ZXY", "func": { "fx": "-z", "fy": "x", "fz": "-y" } }, "LeftUpperArm": { "name": "mixamorigLeftArm", + "order": "ZXY", "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, "LeftLowerArm": { "name": "mixamorigLeftForeArm", + "order": "ZXY", "func": { "fx": "z", "fy": "-x", "fz": "-y" } }, "LeftUpperLeg": { "name": "mixamorigLeftUpLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "LeftLowerLeg": { "name": "mixamorigLeftLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightUpperLeg": { "name": "mixamorigRightUpLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } }, "RightLowerLeg": { "name": "mixamorigRightLeg", + "order": "XYZ", "func": { "fx": "-x", "fy": "y", "fz": "-z" } } }