Skip to content

Commit

Permalink
Fix #412: don't hide held props while unbuckling
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed Oct 23, 2024
1 parent 03a1f62 commit 075423f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions FreeIva/KerbalIvaAddon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -764,11 +764,24 @@ public void HideCurrentKerbal(bool hidden)
// This won't unhide a helmet hidden elsewhere.
if (ActiveKerbal != null)
{
// Since the held prop is a child of the camera, and the camera is a child of the kerbal, make sure we
// don't accidentally hide the held prop too.
Transform oldHeldPropParent = PhysicalProp.HeldProp?.transform.parent;
if (oldHeldPropParent != null)
{
PhysicalProp.HeldProp.transform.SetParent(null, true);
}

Renderer[] renderers = ActiveKerbal.KerbalRef.GetComponentsInChildren<Renderer>();
foreach (var r in renderers)
{
r.enabled = !hidden;
}

if (oldHeldPropParent != null)
{
PhysicalProp.HeldProp.transform.SetParent(oldHeldPropParent, true);
}
}

if (!hidden)
Expand Down

0 comments on commit 075423f

Please sign in to comment.