Skip to content

Commit

Permalink
exclude checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed Jan 22, 2021
1 parent a61c3f9 commit 9b45fb9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ public VRM10SpringJoint(Transform t)
[SerializeField, Range(0, 1)]
public float m_dragForce = 0.4f;

[SerializeField]
public bool m_exclude;

[SerializeField, Range(0, 0.5f), Header("Collision")]
public float m_hitRadius = 0.02f;
public float m_jointRadius = 0.02f;

SpringBoneLogic m_logic;

public void DrawGizmo(Transform center, Color color)
{
if (m_logic != null)
{
m_logic.DrawGizmo(center, m_hitRadius, color);
m_logic.DrawGizmo(center, m_jointRadius, color);
}
else
{
Expand Down Expand Up @@ -69,7 +72,7 @@ public void Update(Transform center, float deltaTime, List<SpringBoneLogic.Inter
}
}

m_logic.Update(center, m_stiffnessForce * deltaTime, m_dragForce, m_gravityDir * (m_gravityPower * deltaTime), colliders, m_hitRadius);
m_logic.Update(center, m_stiffnessForce * deltaTime, m_dragForce, m_gravityDir * (m_gravityPower * deltaTime), colliders, m_jointRadius);
}
}
}
1 change: 1 addition & 0 deletions Assets/VRM10/Runtime/IO/Vrm10Storage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ public SpringBoneManager CreateVrmSpringBone(List<Node> nodes)
joint.GravityDir = gltfJoint.GravityDir.ToVector3();
joint.GravityPower = gltfJoint.GravityPower.Value;
joint.Stiffness = gltfJoint.Stiffness.Value;
joint.Exclude = gltfJoint.Exclude.Value;
springBone.Joints.Add(joint);
}

Expand Down
3 changes: 2 additions & 1 deletion Assets/VRM10/Runtime/UnityBuilder/ComponentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ public static void Build10(VrmLib.Model model, ModelAsset asset)
joint.m_gravityPower = vrmJoint.GravityPower;
joint.m_gravityDir = vrmJoint.GravityDir.ToUnityVector3();
joint.m_dragForce = vrmJoint.DragForce;
joint.m_hitRadius = vrmJoint.HitRadius;
joint.m_jointRadius = vrmJoint.HitRadius;
joint.m_exclude = vrmJoint.Exclude;

springBone.Joints.Add(joint);
}
Expand Down
3 changes: 2 additions & 1 deletion Assets/VRM10/Runtime/VRMConverter/RuntimeVrmConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ public VrmLib.Model ToModelFrom10(GameObject root, VRM10MetaObject metaObject =
GravityPower = joint.m_gravityPower,
GravityDir = joint.m_gravityDir.ToNumericsVector3(),
DragForce = joint.m_dragForce,
HitRadius = joint.m_hitRadius,
HitRadius = joint.m_jointRadius,
Exclude = joint.m_exclude,
});
}

Expand Down
2 changes: 2 additions & 0 deletions Assets/VRM10/vrmlib/Runtime/Vrm/SpringBoneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public SpringJoint(Node node)
public float HitRadius;

public float Stiffness;

public bool Exclude;
}

public class SpringBone
Expand Down

0 comments on commit 9b45fb9

Please sign in to comment.