mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-26 21:01:15 -05:00
phi to pitch. theta to yaw.
This commit is contained in:
@@ -18,8 +18,8 @@ namespace UniVRM10
|
||||
private SerializedProperty m_jointRadiusProp;
|
||||
private SerializedProperty m_angleLimitType;
|
||||
private SerializedProperty m_angleLimitRotation;
|
||||
private SerializedProperty m_angleLimitAngle1;
|
||||
private SerializedProperty m_angleLimitAngle2;
|
||||
private SerializedProperty m_angleLimitPitch;
|
||||
private SerializedProperty m_angleLimitYaw;
|
||||
|
||||
private Vrm10Instance m_root;
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace UniVRM10
|
||||
m_jointRadiusProp = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_jointRadius));
|
||||
m_angleLimitType = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_anglelimitType));
|
||||
m_angleLimitRotation = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_limitSpaceOffset));
|
||||
m_angleLimitAngle1 = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_phi));
|
||||
m_angleLimitAngle2 = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_theta));
|
||||
m_angleLimitPitch = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_pitch));
|
||||
m_angleLimitYaw = serializedObject.FindProperty(nameof(VRM10SpringBoneJoint.m_yaw));
|
||||
|
||||
m_root = m_target.GetComponentInParent<Vrm10Instance>();
|
||||
}
|
||||
@@ -106,18 +106,18 @@ namespace UniVRM10
|
||||
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Cone:
|
||||
EditorGUILayout.PropertyField(m_angleLimitRotation);
|
||||
EditorGUILayout.PropertyField(m_angleLimitAngle1);
|
||||
EditorGUILayout.PropertyField(m_angleLimitPitch);
|
||||
break;
|
||||
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Hinge:
|
||||
EditorGUILayout.PropertyField(m_angleLimitRotation);
|
||||
EditorGUILayout.PropertyField(m_angleLimitAngle1);
|
||||
EditorGUILayout.PropertyField(m_angleLimitPitch);
|
||||
break;
|
||||
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Spherical:
|
||||
EditorGUILayout.PropertyField(m_angleLimitRotation);
|
||||
EditorGUILayout.PropertyField(m_angleLimitAngle1);
|
||||
EditorGUILayout.PropertyField(m_angleLimitAngle2);
|
||||
EditorGUILayout.PropertyField(m_angleLimitPitch);
|
||||
EditorGUILayout.PropertyField(m_angleLimitYaw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -323,16 +323,16 @@ namespace UniVRM10
|
||||
switch (m_target.m_anglelimitType)
|
||||
{
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Cone:
|
||||
DrawCone(limit_tail_pos, m_target.m_phi);
|
||||
DrawCone(limit_tail_pos, m_target.m_pitch);
|
||||
break;
|
||||
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Hinge:
|
||||
DrawHinge(limit_tail_pos, m_target.m_phi, Color.cyan);
|
||||
DrawHinge(limit_tail_pos, m_target.m_pitch, Color.cyan);
|
||||
break;
|
||||
|
||||
case UniGLTF.SpringBoneJobs.AnglelimitTypes.Spherical:
|
||||
DrawHinge(limit_tail_pos, m_target.m_phi, Color.cyan * 0.5f);
|
||||
DrawSpherical(limit_tail_pos, m_target.m_phi, m_target.m_theta);
|
||||
DrawHinge(limit_tail_pos, m_target.m_pitch, Color.cyan * 0.5f);
|
||||
DrawSpherical(limit_tail_pos, m_target.m_pitch, m_target.m_yaw);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@ namespace UniVRM10
|
||||
public Quaternion m_limitSpaceOffset = Quaternion.identity;
|
||||
|
||||
[SerializeField, Range(0, Mathf.PI)]
|
||||
public float m_phi = Mathf.PI;
|
||||
public float m_pitch = Mathf.PI;
|
||||
|
||||
[SerializeField, Range(0, Mathf.PI / 2)]
|
||||
public float m_theta = 0;
|
||||
public float m_yaw = 0;
|
||||
|
||||
public BlittableJointMutable Blittable => new BlittableJointMutable(
|
||||
stiffnessForce: m_stiffnessForce,
|
||||
@@ -46,8 +46,8 @@ namespace UniVRM10
|
||||
radius: m_jointRadius,
|
||||
// v0.129.4
|
||||
angleLimitType: (float)m_anglelimitType,
|
||||
angleLimit1: m_phi,
|
||||
angleLimit2: m_theta,
|
||||
angleLimit1: m_pitch,
|
||||
angleLimit2: m_yaw,
|
||||
angleLimitOffset: m_limitSpaceOffset
|
||||
);
|
||||
|
||||
|
||||
@@ -202,13 +202,13 @@ public static SphericalLimit __limit_Deserialize_Spherical(JsonNode parsed)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="phi"){
|
||||
value.Phi = kv.Value.GetSingle();
|
||||
if(key=="pitch"){
|
||||
value.Pitch = kv.Value.GetSingle();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key=="theta"){
|
||||
value.Theta = kv.Value.GetSingle();
|
||||
if(key=="yaw"){
|
||||
value.Yaw = kv.Value.GetSingle();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,10 @@ namespace UniGLTF.Extensions.VRMC_springBone_limit
|
||||
public object Extras;
|
||||
|
||||
// The phi angle of the spherical limit in radians. If the phi angle is set to π or greater, the angle will be interpreted as π by the implementation.
|
||||
public float? Phi;
|
||||
public float? Pitch;
|
||||
|
||||
// The theta angle of the spherical limit in radians. If the theta angle is set to π/2 or greater, the angle will be interpreted as π/2 by the implementation.
|
||||
public float? Theta;
|
||||
public float? Yaw;
|
||||
|
||||
// The rotation from the default orientation of the spherical limit. The rotation is represented as a quaternion (x, y, z, w), where w is the scalar.
|
||||
public float[] Rotation;
|
||||
|
||||
@@ -184,14 +184,14 @@ public static void __limit_Serialize_Spherical(JsonFormatter f, SphericalLimit v
|
||||
(value.Extras as glTFExtension).Serialize(f);
|
||||
}
|
||||
|
||||
if(value.Phi.HasValue){
|
||||
f.Key("phi");
|
||||
f.Value(value.Phi.GetValueOrDefault());
|
||||
if(value.Pitch.HasValue){
|
||||
f.Key("pitch");
|
||||
f.Value(value.Pitch.GetValueOrDefault());
|
||||
}
|
||||
|
||||
if(value.Theta.HasValue){
|
||||
f.Key("theta");
|
||||
f.Value(value.Theta.GetValueOrDefault());
|
||||
if(value.Yaw.HasValue){
|
||||
f.Key("yaw");
|
||||
f.Value(value.Yaw.GetValueOrDefault());
|
||||
}
|
||||
|
||||
if(value.Rotation!=null&&value.Rotation.Count()>=4){
|
||||
|
||||
@@ -462,7 +462,7 @@ namespace UniVRM10
|
||||
Cone = new UniGLTF.Extensions.VRMC_springBone_limit.ConeLimit
|
||||
{
|
||||
Rotation = ReverseX(y.m_limitSpaceOffset),
|
||||
Angle = y.m_phi,
|
||||
Angle = y.m_pitch,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -480,7 +480,7 @@ namespace UniVRM10
|
||||
Hinge = new UniGLTF.Extensions.VRMC_springBone_limit.HingeLimit
|
||||
{
|
||||
Rotation = ReverseX(y.m_limitSpaceOffset),
|
||||
Angle = y.m_phi,
|
||||
Angle = y.m_pitch,
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -498,8 +498,8 @@ namespace UniVRM10
|
||||
Spherical = new UniGLTF.Extensions.VRMC_springBone_limit.SphericalLimit
|
||||
{
|
||||
Rotation = ReverseX(y.m_limitSpaceOffset),
|
||||
Theta = y.m_theta,
|
||||
Phi = y.m_phi,
|
||||
Pitch = y.m_pitch,
|
||||
Yaw = y.m_yaw,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -636,20 +636,20 @@ namespace UniVRM10
|
||||
{
|
||||
joint.m_anglelimitType = UniGLTF.SpringBoneJobs.AnglelimitTypes.Cone;
|
||||
joint.m_limitSpaceOffset = QuaternionFromFloat4(cone.Rotation);
|
||||
joint.m_phi = cone.Angle.GetValueOrDefault(Mathf.PI * 0.5f);
|
||||
joint.m_pitch = cone.Angle.GetValueOrDefault();
|
||||
}
|
||||
else if (extensionSpringBoneLimit.Limit.Hinge is UniGLTF.Extensions.VRMC_springBone_limit.HingeLimit hinge)
|
||||
{
|
||||
joint.m_anglelimitType = UniGLTF.SpringBoneJobs.AnglelimitTypes.Hinge;
|
||||
joint.m_limitSpaceOffset = QuaternionFromFloat4(hinge.Rotation);
|
||||
joint.m_phi = hinge.Angle.GetValueOrDefault(Mathf.PI * 0.5f);
|
||||
joint.m_pitch = hinge.Angle.GetValueOrDefault();
|
||||
}
|
||||
else if (extensionSpringBoneLimit.Limit.Spherical is UniGLTF.Extensions.VRMC_springBone_limit.SphericalLimit spherical)
|
||||
{
|
||||
joint.m_anglelimitType = UniGLTF.SpringBoneJobs.AnglelimitTypes.Spherical;
|
||||
joint.m_limitSpaceOffset = QuaternionFromFloat4(spherical.Rotation);
|
||||
joint.m_phi = spherical.Phi.GetValueOrDefault(Mathf.PI * 0.5f);
|
||||
joint.m_theta = spherical.Theta.GetValueOrDefault(Mathf.PI * 0.5f);
|
||||
joint.m_pitch = spherical.Pitch.GetValueOrDefault();
|
||||
joint.m_yaw = spherical.Yaw.GetValueOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user