mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-19 21:00:08 +08:00
fix: [ESO] bounds are untransformed when root bone is inconsistent (#440)
Closes: #439
This commit is contained in:
parent
685e690d3a
commit
911dc7bb47
@ -142,7 +142,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
Transform rootBone = null, probeAnchor = null;
|
Transform rootBone = null, probeAnchor = null;
|
||||||
Bounds bounds = ModularAvatarMeshSettings.DEFAULT_BOUNDS;
|
Bounds bounds = ModularAvatarMeshSettings.DEFAULT_BOUNDS;
|
||||||
|
|
||||||
FindConsistentSettings(avatarRoot, ref probeAnchor, ref rootBone, ref bounds);
|
FindConsistentSettings(avatarRoot, avatarHips.transform, ref probeAnchor, ref rootBone, ref bounds);
|
||||||
|
|
||||||
if (probeAnchor == null)
|
if (probeAnchor == null)
|
||||||
{
|
{
|
||||||
@ -168,6 +168,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
|
|
||||||
private static void FindConsistentSettings(
|
private static void FindConsistentSettings(
|
||||||
GameObject avatarRoot,
|
GameObject avatarRoot,
|
||||||
|
Transform avatarHips,
|
||||||
ref Transform probeAnchor,
|
ref Transform probeAnchor,
|
||||||
ref Transform rootBone,
|
ref Transform rootBone,
|
||||||
ref Bounds bounds
|
ref Bounds bounds
|
||||||
@ -210,8 +211,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
if (rootBone != skinnedMeshRenderer.rootBone)
|
if (rootBone != skinnedMeshRenderer.rootBone)
|
||||||
{
|
{
|
||||||
rootBone = null; // inconsistent configuration
|
rootBone = avatarHips; // inconsistent configuration
|
||||||
bounds = ModularAvatarMeshSettings.DEFAULT_BOUNDS;
|
bounds = TransformBounds(rootBone, ModularAvatarMeshSettings.DEFAULT_BOUNDS);
|
||||||
}
|
}
|
||||||
else if (Vector3.Distance(bounds.center, skinnedMeshRenderer.bounds.center) > 0.01f
|
else if (Vector3.Distance(bounds.center, skinnedMeshRenderer.bounds.center) > 0.01f
|
||||||
|| Vector3.Distance(bounds.extents, skinnedMeshRenderer.bounds.extents) > 0.01f)
|
|| Vector3.Distance(bounds.extents, skinnedMeshRenderer.bounds.extents) > 0.01f)
|
||||||
|
Loading…
Reference in New Issue
Block a user