From f1fb4cc7ea0c828308616503c1af6fcd4e8c3858 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 3 Jul 2024 21:07:15 +0900 Subject: [PATCH] =?UTF-8?q?bake=20=E6=99=82=E3=81=AB=20SkinnedMeshRenderer?= =?UTF-8?q?.bones=20=E3=81=AB=20null=20=E3=81=8C=E5=90=AB=E3=81=BE?= =?UTF-8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=81=A6=E3=82=82=E9=80=9A=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniGLTF/Runtime/MeshUtility/MeshAttachInfo.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Assets/UniGLTF/Runtime/MeshUtility/MeshAttachInfo.cs b/Assets/UniGLTF/Runtime/MeshUtility/MeshAttachInfo.cs index 54f36ee4f..b0020bbd8 100644 --- a/Assets/UniGLTF/Runtime/MeshUtility/MeshAttachInfo.cs +++ b/Assets/UniGLTF/Runtime/MeshUtility/MeshAttachInfo.cs @@ -20,7 +20,19 @@ namespace UniGLTF.MeshUtility if (Bones != null) { // recalc bindposes - Mesh.bindposes = Bones.Select(x => x.worldToLocalMatrix * dst.transform.localToWorldMatrix).ToArray(); + Mesh.bindposes = Bones.Select(x => + { + if (x != null) + { + return x.worldToLocalMatrix * dst.transform.localToWorldMatrix; + } + else + { + // ボーンが削除された + return dst.transform.localToWorldMatrix; + } + } + ).ToArray(); if (dst.GetComponent() is SkinnedMeshRenderer dstRenderer) {