mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-27 05:27:53 -05:00
Merge pull request #1664 from ousttrue/fix10/springbone_center
[1.0] SpringBone.center 復活
This commit is contained in:
commit
bcbd4b9cd4
|
|
@ -38,9 +38,6 @@ namespace UniVRM10
|
|||
[SerializeField, Header("Runtime")]
|
||||
public UpdateTypes UpdateType = UpdateTypes.LateUpdate;
|
||||
|
||||
[SerializeField]
|
||||
public Transform SpringBoneCenter;
|
||||
|
||||
[SerializeField, Header("LookAt")]
|
||||
public bool DrawLookAtGizmo = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ namespace UniVRM10
|
|||
[SerializeField]
|
||||
public List<VRM10SpringBoneJoint> Joints = new List<VRM10SpringBoneJoint>();
|
||||
|
||||
[SerializeField]
|
||||
public Transform Center;
|
||||
|
||||
public Spring(string name)
|
||||
{
|
||||
Name = name;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace UniVRM10
|
|||
return new FastSpringBoneBuffer(
|
||||
springBone.Springs.Select(spring => new FastSpringBoneSpring
|
||||
{
|
||||
center = m_target.SpringBoneCenter,
|
||||
center = spring.Center,
|
||||
colliders = spring.ColliderGroups
|
||||
.SelectMany(group => group.Colliders)
|
||||
.Select(collider => new FastSpringBoneCollider
|
||||
|
|
|
|||
|
|
@ -323,6 +323,11 @@ public static Spring Deserialize_Springs_ITEM(JsonNode parsed)
|
|||
continue;
|
||||
}
|
||||
|
||||
if(key=="center"){
|
||||
value.Center = kv.Value.GetInt32();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ namespace UniGLTF.Extensions.VRMC_springBone
|
|||
|
||||
// Indices of ColliderGroups that detect collision with this spring.
|
||||
public int[] ColliderGroups;
|
||||
|
||||
// An index of node which is used as a root of center space.
|
||||
public int? Center;
|
||||
}
|
||||
|
||||
public class VRMC_springBone
|
||||
|
|
|
|||
|
|
@ -305,6 +305,11 @@ public static void Serialize_Springs_ITEM(JsonFormatter f, Spring value)
|
|||
__springs_ITEM_Serialize_ColliderGroups(f, value.ColliderGroups);
|
||||
}
|
||||
|
||||
if(value.Center.HasValue){
|
||||
f.Key("center");
|
||||
f.Value(value.Center.GetValueOrDefault());
|
||||
}
|
||||
|
||||
f.EndMap();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -394,6 +394,16 @@ namespace UniVRM10
|
|||
Joints = x.Joints.Select(y => ExportJoint(y, getNodeIndexFromTransform)).ToList(),
|
||||
ColliderGroups = x.ColliderGroups.Select(y => controller.SpringBone.ColliderGroups.IndexOf(y)).ToArray(),
|
||||
};
|
||||
|
||||
if (x.Center != null)
|
||||
{
|
||||
var center = model.Nodes.IndexOf(converter.Nodes[x.Center.gameObject]);
|
||||
if (center != -1)
|
||||
{
|
||||
spring.Center = center;
|
||||
}
|
||||
}
|
||||
|
||||
springBone.Springs.Add(spring);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -595,6 +595,11 @@ namespace UniVRM10
|
|||
var spring = new Vrm10InstanceSpringBone.Spring(gltfSpring.Name);
|
||||
controller.SpringBone.Springs.Add(spring);
|
||||
|
||||
if (gltfSpring.Center.HasValue)
|
||||
{
|
||||
spring.Center = Nodes[gltfSpring.Center.Value];
|
||||
}
|
||||
|
||||
if (gltfSpring.ColliderGroups != null)
|
||||
{
|
||||
spring.ColliderGroups = gltfSpring.ColliderGroups.Select(x => controller.SpringBone.ColliderGroups[x]).ToList();
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 741b0c3f3cb44111d9e9ea179de9e3fc545ac50a
|
||||
Subproject commit 729461b5c0e22bf74bda2c074c04299187af6333
|
||||
Loading…
Reference in New Issue
Block a user