fix(transform): return from monster forms without replaying the spawn animation

Hiding the human body with SetActive(false) on the player's "Visual" also
disabled the Animator that lives on it, and Unity rebinds an Animator when it
is re-enabled: the controller restarts from its entry state, which for the
player is the get-up clip played when joining a world. Every Skadi dragon form,
Bat Form and Mist Form therefore ended with the player standing back up off the
ground.

PlayerVisualHider hides the body by suppressing its renderers instead, leaving
the GameObject active so the Animator and ZSyncAnimation keep running for the
whole transformation. Hiding uses forceRenderingOff on top of Renderer.enabled,
which nothing else in the game writes on a character, so the body cannot be
un-hidden behind our back.

Applied to the local and remote paths of both races, and to the ZDO sync's
revert so a remote player who dies mid-form cannot stay invisible.
This commit is contained in:
kanym 2026-08-02 18:56:51 +02:00
commit 4793811978
6 changed files with 175 additions and 46 deletions

View file

@ -62,7 +62,7 @@ namespace RacesOfValheim
if (string.IsNullOrEmpty(formName))
{
if (playerVisual != null) playerVisual.gameObject.SetActive(true);
PlayerVisualHider.Show(playerVisual, "skadi-remote-revert");
return;
}
@ -84,7 +84,7 @@ namespace RacesOfValheim
}
}
if (playerVisual != null) playerVisual.gameObject.SetActive(false);
PlayerVisualHider.Hide(playerVisual, "skadi-remote-form");
}
}