From cb3b0a6ac8ce7ab6bd2bc5ed8e0e1bfca1f60e4c Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 6 Nov 2024 14:33:23 +0900 Subject: [PATCH] =?UTF-8?q?VRMFirstPerson=20=E7=84=A1=E3=81=84=E6=99=82?= =?UTF-8?q?=E3=81=8C=E3=81=82=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM/Runtime/IO/VrmGeometryBackup.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs b/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs index a1d62feba..f7b79fcb3 100644 --- a/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs +++ b/Assets/VRM/Runtime/IO/VrmGeometryBackup.cs @@ -72,8 +72,12 @@ namespace VRM { _springBoneColliders = root.GetComponentsInChildren().ToDictionary(x => x, x => new VrmSpringBoneColliderBackup(x)); _springBones = root.GetComponentsInChildren().ToDictionary(x => x, x => new VrmSpringBoneBackup(x)); + _firstPerson = root.GetComponent(); - _firstPersonOffsetInWorld = _firstPerson.transform.TransformPoint(_firstPerson.FirstPersonOffset); + if (_firstPerson != null) + { + _firstPersonOffsetInWorld = _firstPerson.transform.TransformPoint(_firstPerson.FirstPersonOffset); + } } public void Dispose() @@ -86,7 +90,11 @@ namespace VRM { v.Restore(k); } - _firstPerson.FirstPersonOffset = _firstPerson.transform.worldToLocalMatrix.MultiplyPoint(_firstPersonOffsetInWorld); + + if (_firstPerson != null) + { + _firstPerson.FirstPersonOffset = _firstPerson.transform.worldToLocalMatrix.MultiplyPoint(_firstPersonOffsetInWorld); + } } } } \ No newline at end of file