diff --git a/Assets/VRM10/Editor/Components/Constraint/VRM10PostionRotationConstraintEditorBase.cs b/Assets/VRM10/Editor/Components/Constraint/VRM10PostionRotationConstraintEditorBase.cs index 76a755f18..fcd5e8c6b 100644 --- a/Assets/VRM10/Editor/Components/Constraint/VRM10PostionRotationConstraintEditorBase.cs +++ b/Assets/VRM10/Editor/Components/Constraint/VRM10PostionRotationConstraintEditorBase.cs @@ -96,9 +96,9 @@ namespace UniVRM10 // show dst { var sb = new StringBuilder(); - sb.AppendLine(m_target.FreezeAxes.HasFlag(AxisMask.X) ? $"freeze" : $"{delta.x:0.00}"); - sb.AppendLine(m_target.FreezeAxes.HasFlag(AxisMask.Y) ? $"freeze" : $"{delta.y:0.00}"); - sb.Append(m_target.FreezeAxes.HasFlag(AxisMask.Z) ? $"freeze" : $"{delta.z:0.00}"); + sb.AppendLine(m_target.Axes.HasFlag(AxisMask.X) ? $"{delta.x:0.00}" : "----"); + sb.AppendLine(m_target.Axes.HasFlag(AxisMask.Y) ? $"{delta.y:0.00}" : "----"); + sb.Append(m_target.Axes.HasFlag(AxisMask.Z) ? $"{delta.z:0.00}" : "----"); Handles.Label(m_target.GetComponent().transform.position, sb.ToString(), Style); } diff --git a/Assets/VRM10/Runtime/Components/Constraint/ConstraintAxes.cs b/Assets/VRM10/Runtime/Components/Constraint/ConstraintAxes.cs index ab3fd2ce3..6fe4e9397 100644 --- a/Assets/VRM10/Runtime/Components/Constraint/ConstraintAxes.cs +++ b/Assets/VRM10/Runtime/Components/Constraint/ConstraintAxes.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace UniVRM10 { /// - /// FreezeAxesで使う。bitマスク + /// Axesで使う。bitマスク /// [Flags] public enum AxisMask @@ -23,17 +23,17 @@ namespace UniVRM10 public static class AxesMaskExtensions { - public static Vector3 Freeze(this AxisMask mask, Vector3 src) + public static Vector3 Mask(this AxisMask mask, Vector3 src) { - if (mask.HasFlag(AxisMask.X)) + if (!mask.HasFlag(AxisMask.X)) { src.x = 0; } - if (mask.HasFlag(AxisMask.Y)) + if (!mask.HasFlag(AxisMask.Y)) { src.y = 0; } - if (mask.HasFlag(AxisMask.Z)) + if (!mask.HasFlag(AxisMask.Z)) { src.z = 0; } diff --git a/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationConstraint.cs b/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationConstraint.cs index 069a509d8..ba762d967 100644 --- a/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationConstraint.cs +++ b/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationConstraint.cs @@ -10,7 +10,7 @@ namespace UniVRM10 [DisallowMultipleComponent] public class VRM10RotationConstraint : VRM10RotationPositionConstraintBase { - public override Vector3 Delta => FreezeAxes.Freeze(Quaternion.Slerp(Quaternion.identity, m_delta.Rotation, Weight).eulerAngles); + public override Vector3 Delta => Axes.Mask(Quaternion.Slerp(Quaternion.identity, m_delta.Rotation, Weight).eulerAngles); public override TR GetSourceCurrent() { diff --git a/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationPositionConstraintBase.cs b/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationPositionConstraintBase.cs index af042354f..7c4cf74e8 100644 --- a/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationPositionConstraintBase.cs +++ b/Assets/VRM10/Runtime/Components/Constraint/VRM10RotationPositionConstraintBase.cs @@ -8,11 +8,11 @@ namespace UniVRM10 { [SerializeField] [EnumFlags] - AxisMask m_freezeAxes = default; - public AxisMask FreezeAxes + AxisMask m_axes = AxisMask.X | AxisMask.Y | AxisMask.Z; + public AxisMask Axes { - get => m_freezeAxes; - set => m_freezeAxes = value; + get => m_axes; + set => m_axes = value; } #region Source diff --git a/Assets/VRM10/Runtime/Format/Constraints/Deserializer.g.cs b/Assets/VRM10/Runtime/Format/Constraints/Deserializer.g.cs index 8f392b14b..0788569ea 100644 --- a/Assets/VRM10/Runtime/Format/Constraints/Deserializer.g.cs +++ b/Assets/VRM10/Runtime/Format/Constraints/Deserializer.g.cs @@ -116,8 +116,8 @@ public static RotationConstraint __constraint_Deserialize_Rotation(JsonNode pars continue; } - if(key=="freezeAxes"){ - value.FreezeAxes = __constraint__rotation_Deserialize_FreezeAxes(kv.Value); + if(key=="axes"){ + value.Axes = __constraint__rotation_Deserialize_Axes(kv.Value); continue; } @@ -130,7 +130,7 @@ public static RotationConstraint __constraint_Deserialize_Rotation(JsonNode pars return value; } -public static bool[] __constraint__rotation_Deserialize_FreezeAxes(JsonNode parsed) +public static bool[] __constraint__rotation_Deserialize_Axes(JsonNode parsed) { var value = new bool[parsed.GetArrayCount()]; int i=0; diff --git a/Assets/VRM10/Runtime/Format/Constraints/Format.g.cs b/Assets/VRM10/Runtime/Format/Constraints/Format.g.cs index 2ba238224..3f54d5ead 100644 --- a/Assets/VRM10/Runtime/Format/Constraints/Format.g.cs +++ b/Assets/VRM10/Runtime/Format/Constraints/Format.g.cs @@ -21,7 +21,7 @@ namespace UniGLTF.Extensions.VRMC_node_constraint public int? Source; // Axes be constrained by this constraint, in X-Y-Z order. - public bool[] FreezeAxes; + public bool[] Axes; // The weight of the constraint. public float? Weight; diff --git a/Assets/VRM10/Runtime/Format/Constraints/Serializer.g.cs b/Assets/VRM10/Runtime/Format/Constraints/Serializer.g.cs index 4f533e337..4a88b27fb 100644 --- a/Assets/VRM10/Runtime/Format/Constraints/Serializer.g.cs +++ b/Assets/VRM10/Runtime/Format/Constraints/Serializer.g.cs @@ -104,9 +104,9 @@ public static void __constraint_Serialize_Rotation(JsonFormatter f, RotationCons f.Value(value.Source.GetValueOrDefault()); } - if(value.FreezeAxes!=null&&value.FreezeAxes.Count()>=3){ - f.Key("freezeAxes"); - __constraint__rotation_Serialize_FreezeAxes(f, value.FreezeAxes); + if(value.Axes!=null&&value.Axes.Count()>=3){ + f.Key("axes"); + __constraint__rotation_Serialize_Axes(f, value.Axes); } if(value.Weight.HasValue){ @@ -117,7 +117,7 @@ public static void __constraint_Serialize_Rotation(JsonFormatter f, RotationCons f.EndMap(); } -public static void __constraint__rotation_Serialize_FreezeAxes(JsonFormatter f, bool[] value) +public static void __constraint__rotation_Serialize_Axes(JsonFormatter f, bool[] value) { f.BeginList(); diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs index 01096c847..8768380ef 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs @@ -439,7 +439,7 @@ namespace UniVRM10 Rotation = new UniGLTF.Extensions.VRMC_node_constraint.RotationConstraint { Source = model.Nodes.IndexOf(converter.Nodes[c.Source.gameObject]), - FreezeAxes = ToArray(c.FreezeAxes), + Axes = ToArray(c.Axes), Weight = c.Weight, }, }, diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index ddd1649e9..c138e1473 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -613,7 +613,7 @@ namespace UniVRM10 } } - static AxisMask FreezeAxis(bool[] flags) + static AxisMask ConstraintAxes(bool[] flags) { var mask = default(AxisMask); if (flags != null && flags.Length == 3) @@ -651,7 +651,7 @@ namespace UniVRM10 var r = constraint.Rotation; var rotationConstraint = node.gameObject.AddComponent(); rotationConstraint.Source = Nodes[r.Source.Value]; - rotationConstraint.FreezeAxes = FreezeAxis(r.FreezeAxes); + rotationConstraint.Axes = ConstraintAxes(r.Axes); rotationConstraint.Weight = r.Weight.Value; rotationConstraint.ModelRoot = Root.transform; } diff --git a/vrm-specification b/vrm-specification index 4b63473e7..084c4fd3a 160000 --- a/vrm-specification +++ b/vrm-specification @@ -1 +1 @@ -Subproject commit 4b63473e79d96ab7e52d071a5b99d643b0d7cf20 +Subproject commit 084c4fd3a19f4a94b854c35661151c23d526d26a