From 1204d83ddc8a395bdfe27ed421e6c42244dc6eff Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 16 Apr 2021 19:13:38 +0900 Subject: [PATCH] =?UTF-8?q?RuntimeUnityBuilder=20=E3=81=AE=20VRM=E9=83=A8?= =?UTF-8?q?=E5=88=86=E3=81=A7=E3=80=81=E5=BF=85=E8=A6=81=E3=81=AA=E5=BA=A7?= =?UTF-8?q?=E6=A8=99=E5=A4=89=E6=8F=9B(x=E5=8F=8D=E8=BB=A2)=E3=81=8C?= =?UTF-8?q?=E7=84=A1=E3=81=8B=E3=81=A3=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mesh, Node は、VrmLib.Model を介して座標変換されている。 --- Assets/VRM10/Runtime/IO/RuntimeUnityBuilder.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/RuntimeUnityBuilder.cs b/Assets/VRM10/Runtime/IO/RuntimeUnityBuilder.cs index e86ee09bb..6cceca31e 100644 --- a/Assets/VRM10/Runtime/IO/RuntimeUnityBuilder.cs +++ b/Assets/VRM10/Runtime/IO/RuntimeUnityBuilder.cs @@ -372,7 +372,7 @@ namespace UniVRM10 var joint = new VRM10SpringJoint(Nodes[gltfJoint.Node.Value]); joint.m_jointRadius = gltfJoint.HitRadius.Value; joint.m_dragForce = gltfJoint.DragForce.Value; - joint.m_gravityDir = Vector3(gltfJoint.GravityDir); + joint.m_gravityDir = Vector3InvertX(gltfJoint.GravityDir); joint.m_gravityPower = gltfJoint.GravityPower.Value; joint.m_stiffnessForce = gltfJoint.Stiffness.Value; // joint.m_exclude = gltfJoint.Exclude.GetValueOrDefault(); @@ -398,7 +398,7 @@ namespace UniVRM10 return new VRM10SpringBoneCollider { ColliderType = VRM10SpringBoneColliderTypes.Sphere, - Offset = Vector3(x.Sphere.Offset), + Offset = Vector3InvertX(x.Sphere.Offset), Radius = x.Sphere.Radius.Value, }; } @@ -407,9 +407,9 @@ namespace UniVRM10 return new VRM10SpringBoneCollider { ColliderType = VRM10SpringBoneColliderTypes.Capsule, - Offset = Vector3(x.Capsule.Offset), + Offset = Vector3InvertX(x.Capsule.Offset), Radius = x.Capsule.Radius.Value, - Tail = Vector3(x.Capsule.Tail), + Tail = Vector3InvertX(x.Capsule.Tail), }; } else @@ -441,12 +441,12 @@ namespace UniVRM10 return mask; } - static Vector3 Vector3(float[] f) + static Vector3 Vector3InvertX(float[] f) { var v = default(Vector3); if (f != null && f.Length == 3) { - v.x = f[0]; + v.x = -f[0]; v.y = f[1]; v.z = f[2]; } @@ -489,8 +489,8 @@ namespace UniVRM10 var a = constraint.Aim; var aimConstraint = node.gameObject.AddComponent(); aimConstraint.Source = Nodes[a.Source.Value]; - aimConstraint.AimVector = Vector3(a.AimVector); - aimConstraint.UpVector = Vector3(a.UpVector); + aimConstraint.AimVector = Vector3InvertX(a.AimVector); + aimConstraint.UpVector = Vector3InvertX(a.UpVector); } } }