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:
parent
cac1f4ce37
commit
4793811978
6 changed files with 175 additions and 46 deletions
|
|
@ -241,10 +241,8 @@ namespace RacesOfValheim
|
|||
if (m_player.transform.localScale != Vector3.one) m_player.transform.localScale = Vector3.one;
|
||||
|
||||
Transform playerVisual = m_player.transform.Find("Visual");
|
||||
if (playerVisual != null && playerVisual.localScale != Vector3.one)
|
||||
{
|
||||
playerVisual.localScale = Vector3.one;
|
||||
}
|
||||
// Also clears a hidden body left behind if a remote player died mid-transformation.
|
||||
PlayerVisualHider.Show(playerVisual, "zdosync-revert");
|
||||
|
||||
if (m_currentFormInstance != null) Destroy(m_currentFormInstance);
|
||||
EnsureFireAuraVFX(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue