Skip to content

Commit

Permalink
Merge pull request #2322 from ousttrue/fix/VRMC_springBone_extended_c…
Browse files Browse the repository at this point in the history
…ollider_exporter

VRMC_springBone_extended_collider exporter を修正しました。
  • Loading branch information
ousttrue authored Jun 17, 2024
2 parents 7983264 + 40c446e commit 8b09ff9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Assets/VRM10/Runtime/IO/Vrm10Exporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,18 @@ static UniGLTF.Extensions.VRMC_springBone.ColliderShape ExportShape(VRM10SpringB
};
break;
}

default:
{
// 既存実装で未知の collider が来た時に throw しているので
// 回避するために適当な Shpere を作る。
shape.Sphere = new UniGLTF.Extensions.VRMC_springBone.ColliderShapeSphere
{
Radius = 0,
Offset = new float[] { 0, 0, 0 },
};
break;
}
}
return shape;
}
Expand Down Expand Up @@ -435,15 +447,19 @@ static UniGLTF.Extensions.VRMC_springBone.VRMC_springBone ExportSpringBone(Vrm10
Node = getNodeIndexFromTransform(c.transform),
Shape = ExportShape(c),
};

if (c.ColliderType == VRM10SpringBoneColliderTypes.SphereInside
|| c.ColliderType == VRM10SpringBoneColliderTypes.CapsuleInside
|| c.ColliderType == VRM10SpringBoneColliderTypes.Plane
)
{
exportCollider.Extensions = new UniGLTF.Extensions.VRMC_springBone_extended_collider.VRMC_springBone_extended_collider
var extendedCollider = new UniGLTF.Extensions.VRMC_springBone_extended_collider.VRMC_springBone_extended_collider
{
Shape = ExportShapeExtended(c),
};
glTFExtension extensions = default;
UniGLTF.Extensions.VRMC_springBone_extended_collider.GltfSerializer.SerializeTo(ref extensions, extendedCollider);
exportCollider.Extensions = extensions;
}
springBone.Colliders.Add(exportCollider);
}
Expand Down

0 comments on commit 8b09ff9

Please sign in to comment.