From 13951bd0278cf039f498532e3fd434cba5c329da Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 2 Apr 2018 19:18:01 +0900 Subject: [PATCH] fix BlendShape rotation --- Scripts/SkinnedMeshUtility/Editor/BoneNormalizer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Scripts/SkinnedMeshUtility/Editor/BoneNormalizer.cs b/Scripts/SkinnedMeshUtility/Editor/BoneNormalizer.cs index a6b376721..db7e6d033 100644 --- a/Scripts/SkinnedMeshUtility/Editor/BoneNormalizer.cs +++ b/Scripts/SkinnedMeshUtility/Editor/BoneNormalizer.cs @@ -155,6 +155,8 @@ namespace VRM } mesh.boneWeights = srcMesh.boneWeights; + var blendShapeMatrix = default(Matrix4x4); + blendShapeMatrix.SetTRS(Vector3.zero, src.localRotation, Vector3.one); for (int i = 0; i < srcMesh.blendShapeCount; ++i) { var vertices = srcMesh.vertices; @@ -176,8 +178,8 @@ namespace VRM { mesh.AddBlendShapeFrame(name, srcMesh.GetBlendShapeFrameWeight(i, 0), - vertices.Select(x => m.MultiplyPoint(x) * s).ToArray(), - normals.Select(x => m.MultiplyVector(x).normalized).ToArray(), + vertices.Select(x => blendShapeMatrix.MultiplyPoint(x) * s).ToArray(), + normals.Select(x => blendShapeMatrix.MultiplyVector(x).normalized).ToArray(), tangents ); }