fix: automatic bounds does not account for armature scale (#423)

This commit is contained in:
bd_ 2023-09-08 19:59:26 +09:00 committed by GitHub
parent b6537da650
commit f9c19c6d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,7 +213,7 @@ namespace nadena.dev.modular_avatar.core.editor
else if (Vector3.Distance(bounds.center, skinnedMeshRenderer.bounds.center) > 0.01f
|| Vector3.Distance(bounds.extents, skinnedMeshRenderer.bounds.extents) > 0.01f)
{
bounds = ModularAvatarMeshSettings.DEFAULT_BOUNDS;
bounds = TransformBounds(rootBone, ModularAvatarMeshSettings.DEFAULT_BOUNDS);
}
}
@ -221,6 +221,13 @@ namespace nadena.dev.modular_avatar.core.editor
}
}
private static Bounds TransformBounds(Transform rootBone, Bounds bounds)
{
bounds.extents = bounds.extents / (Vector3.Dot(rootBone.lossyScale, Vector3.one) / 3);
return bounds;
}
static bool ValidateSetupOutfit()
{
errorHeader = S("setup_outfit.err.header.notarget");