diff --git a/JotunnModStub/RaceEyeHeight.cs b/JotunnModStub/RaceEyeHeight.cs
index 7195861..563f50d 100644
--- a/JotunnModStub/RaceEyeHeight.cs
+++ b/JotunnModStub/RaceEyeHeight.cs
@@ -24,7 +24,8 @@ namespace RacesOfValheim
/// their eye with them, and read as a factor of 1 here, so they are left alone by
/// construction. So is a player inside a borrowed form (wolf, drake, bat): those hide the
/// body's renderers and leave its scale at 1, and the form's own camera handling is its
- /// business.
+ /// business. The Trenta's Muspell is the exception: it hands over its own eye height, see
+ /// TrentaMuspell.TryGetEyeHeight.
///
/// Applied to every player, not just the one at the keyboard. m_eye is also what a mob aims
/// at, so a Dvergar's head being where the Dvergar's head is matters on every client.
@@ -66,10 +67,21 @@ namespace RacesOfValheim
rest.LocalPosition = eye.localPosition;
}
- float scale = visual.transform.localScale.y;
- if (scale < MinScale) return;
+ Vector3 wanted;
+ if (TrentaMuspell.TryGetEyeHeight(player, out float formEye))
+ {
+ // The one borrowed form that sets its own eye: the Muspell is too tall to look out
+ // of from a person's height. Asked before the hidden-body check below, because the
+ // Muspell is exactly what hides the body.
+ wanted = new Vector3(rest.LocalPosition.x, formEye, rest.LocalPosition.z);
+ }
+ else
+ {
+ float scale = visual.transform.localScale.y;
+ if (scale < MinScale) return;
+ wanted = rest.LocalPosition * scale;
+ }
- Vector3 wanted = rest.LocalPosition * scale;
if ((eye.localPosition - wanted).sqrMagnitude > 0.000001f)
{
eye.localPosition = wanted;
diff --git a/JotunnModStub/Trenta/TrentaMuspell.cs b/JotunnModStub/Trenta/TrentaMuspell.cs
index 2864acf..1ae8011 100644
--- a/JotunnModStub/Trenta/TrentaMuspell.cs
+++ b/JotunnModStub/Trenta/TrentaMuspell.cs
@@ -22,6 +22,31 @@ namespace RacesOfValheim
private static GameObject currentTransformation;
private static bool isTransformingSequence;
+ ///
+ /// How high the form's head sits above the player's feet at a form scale of 1, measured
+ /// off the clone the moment it is made. Multiplied by the form's current scale it gives the
+ /// eye height, so the camera rides the grow and shrink tween with the model.
+ ///
+ private static float headHeightAtScaleOne;
+
+ ///
+ /// The eye height the Muspell wants for , for RaceEyeHeight.
+ ///
+ /// The form hides the player's own body by shrinking its Visual to 0.001, and RaceEyeHeight
+ /// reads anything that small as "hidden" and leaves the eye alone - so the camera stayed at
+ /// a person's eye level inside something the size of a house. The form is local only, so
+ /// this only ever answers for the local player.
+ ///
+ public static bool TryGetEyeHeight(Player player, out float height)
+ {
+ height = 0f;
+ if (!IsTransformed || currentTransformation == null || headHeightAtScaleOne <= 0f) return false;
+ if (player == null || player != Player.m_localPlayer) return false;
+
+ height = headHeightAtScaleOne * currentTransformation.transform.localScale.y;
+ return true;
+ }
+
public static void Toggle(Player player)
{
if (isTransformingSequence) return;
@@ -167,6 +192,14 @@ namespace RacesOfValheim
currentTransformation.transform.localPosition = Vector3.zero;
currentTransformation.transform.localRotation = Quaternion.identity;
+ // Measured here, straight off the clone, before the grow tween touches its scale. The
+ // head is the same bone the spike volley fires from.
+ Transform head = currentTransformation.transform.Find(MuspellFormBehavior.HeadPath);
+ float cloneScale = currentTransformation.transform.localScale.y;
+ headHeightAtScaleOne = head != null && cloneScale > 0f
+ ? (head.position.y - player.transform.position.y) / cloneScale
+ : 0f;
+
// Same reasoning as FenrirRace.ExecuteTransformation: the clone must never carry
// whatever AI/gameplay component made the source a functioning boss.
Component animEvent = currentTransformation.GetComponent("AnimEvent");
@@ -219,6 +252,8 @@ namespace RacesOfValheim
///
public class MuspellFormBehavior : MonoBehaviour
{
+ public const string HeadPath = "Armature/root/spine1/spine2/spine3/head";
+
private Animator playerAnim;
private Animator formAnim;
private Transform muzzle;
@@ -232,7 +267,7 @@ namespace RacesOfValheim
// The spike volley should leave from the Elder's own mouth, not the (now hidden)
// player's eye point underneath it.
- muzzle = transform.Find("Armature/root/spine1/spine2/spine3/head");
+ muzzle = transform.Find(HeadPath);
}
private void Update()