Skip to content

Commit 075423f

Browse files
committed
Fix #412: don't hide held props while unbuckling
1 parent 03a1f62 commit 075423f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

FreeIva/KerbalIvaAddon.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,24 @@ public void HideCurrentKerbal(bool hidden)
764764
// This won't unhide a helmet hidden elsewhere.
765765
if (ActiveKerbal != null)
766766
{
767+
// Since the held prop is a child of the camera, and the camera is a child of the kerbal, make sure we
768+
// don't accidentally hide the held prop too.
769+
Transform oldHeldPropParent = PhysicalProp.HeldProp?.transform.parent;
770+
if (oldHeldPropParent != null)
771+
{
772+
PhysicalProp.HeldProp.transform.SetParent(null, true);
773+
}
774+
767775
Renderer[] renderers = ActiveKerbal.KerbalRef.GetComponentsInChildren<Renderer>();
768776
foreach (var r in renderers)
769777
{
770778
r.enabled = !hidden;
771779
}
780+
781+
if (oldHeldPropParent != null)
782+
{
783+
PhysicalProp.HeldProp.transform.SetParent(oldHeldPropParent, true);
784+
}
772785
}
773786

774787
if (!hidden)

0 commit comments

Comments
 (0)