diff --git a/Assets/UniGLTF/Runtime/Extensions/NumericsExtensions.cs b/Assets/UniGLTF/Runtime/Extensions/NumericsExtensions.cs index 0a123c7f5..589738ac7 100644 --- a/Assets/UniGLTF/Runtime/Extensions/NumericsExtensions.cs +++ b/Assets/UniGLTF/Runtime/Extensions/NumericsExtensions.cs @@ -49,6 +49,10 @@ namespace UniGLTF public static (Vector3, float) GetAxisAngle(this Quaternion q) { var qw = q.W; + if (qw == 1) + { + return (Vector3.UnitX, 0); + } var angle = 2 * Math.Acos(qw); var x = q.X / Math.Sqrt(1 - qw * qw); var y = q.Y / Math.Sqrt(1 - qw * qw); diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index 2906b4e6c..d1de0411f 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -648,12 +648,16 @@ namespace UniVRM10 public static void CreateNodes(VrmLib.Node node, GameObject parent, Dictionary nodes) { GameObject go = new GameObject(node.Name); - go.transform.SetPositionAndRotation(node.Translation.ToUnityVector3(), node.Rotation.ToUnityQuaternion()); nodes.Add(node, go); + + // world + go.transform.SetPositionAndRotation(node.Translation.ToUnityVector3(), node.Rotation.ToUnityQuaternion()); if (parent != null) { - go.transform.SetParent(parent.transform); + go.transform.SetParent(parent.transform, true); } + // local + go.transform.localScale = node.LocalScaling.ToUnityVector3(); if (node.Children.Count > 0) { diff --git a/Assets/VRM10/Runtime/IO/Vrm10Storage.cs b/Assets/VRM10/Runtime/IO/Vrm10Storage.cs index fd6856238..9c356f4fb 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Storage.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Storage.cs @@ -407,7 +407,7 @@ namespace UniVRM10 { node.LocalRotation = x.rotation.ToQuaternion(); } - if (x.scale != null && x.scale.Length == 4) + if (x.scale != null && x.scale.Length == 3) { node.LocalScaling = x.scale.ToVector3(Vector3.One); }