From ff366ac9e72248475c47b62a44b6d68188da82c5 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 27 Dec 2021 18:11:47 +0900 Subject: [PATCH] =?UTF-8?q?JSON=E3=82=AD=E3=83=BC=E7=9C=81=E7=95=A5?= =?UTF-8?q?=E6=99=82=E3=81=AB=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88?= =?UTF-8?q?=E5=80=A4=E3=82=92=E8=A3=9C=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM10/Runtime/IO/Vrm10Importer.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index 140f8011f..8cb3afab4 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -587,13 +587,18 @@ namespace UniVRM10 { throw new IndexOutOfRangeException($"{index} > {Nodes.Count}"); } + // https://github.com/vrm-c/UniVRM/issues/1441 + // + // https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_springBone-1.0-beta/schema/VRMC_springBone.joint.schema.json + // に基づきデフォルト値を補う + + // node is required var joint = Nodes[gltfJoint.Node.Value].gameObject.AddComponent(); - joint.m_jointRadius = gltfJoint.HitRadius.Value; - joint.m_dragForce = gltfJoint.DragForce.Value; - joint.m_gravityDir = Vector3InvertX(gltfJoint.GravityDir); - joint.m_gravityPower = gltfJoint.GravityPower.Value; - joint.m_stiffnessForce = gltfJoint.Stiffness.Value; - // joint.m_exclude = gltfJoint.Exclude.GetValueOrDefault(); + joint.m_jointRadius = gltfJoint.HitRadius.GetValueOrDefault(0.0f); + joint.m_dragForce = gltfJoint.DragForce.GetValueOrDefault(0.5f); + joint.m_gravityDir = gltfJoint.GravityDir != null ? Vector3InvertX(gltfJoint.GravityDir) : Vector3.down; + joint.m_gravityPower = gltfJoint.GravityPower.GetValueOrDefault(0.0f); + joint.m_stiffnessForce = gltfJoint.Stiffness.GetValueOrDefault(1.0f); spring.Joints.Add(joint); } }