diff --git a/KSPCommunityFixes/BugFixes/PartBoundsIgnoreDisabledTransforms.cs b/KSPCommunityFixes/BugFixes/PartBoundsIgnoreDisabledTransforms.cs index 5dfbc88..146559a 100644 --- a/KSPCommunityFixes/BugFixes/PartBoundsIgnoreDisabledTransforms.cs +++ b/KSPCommunityFixes/BugFixes/PartBoundsIgnoreDisabledTransforms.cs @@ -52,7 +52,7 @@ static bool PartGeometryUtil_GetPartRendererBounds_Prefix(Part p, out Bounds[] _ // // This matches the same rule as done in https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/150 // which isn't really perfect, but is probably good enough for our purposes. - bool ignoreTransparentFX = !p.frozen; + bool ignoreTransparentFX = !p.frozen && !AllParentsTransparent(p.transform); try { @@ -69,6 +69,12 @@ static bool PartGeometryUtil_GetPartRendererBounds_Prefix(Part p, out Bounds[] _ return false; } + static bool AllParentsTransparent(Transform t) + { + if (t.gameObject.layer != LayerMask.NameToLayer("TransparentFX")) return false; + if (t.parent == null) return true; + return AllParentsTransparent(t.parent); + } static readonly List rendererBuffer = [];