diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index a6a86dc..1afbe7c 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -68,7 +68,7 @@ namespace RacesOfValheim public static readonly float EyeSeparation = 0.032f; // half the distance between them public static readonly float EyeForward = 0.081f; // centre out from the head bone public static readonly float EyeHeight = 0.181f; // up from the head bone - public static readonly float EyeSize = 0.062f; // across, so a 24mm radius at 0.78 + public static readonly float EyeSize = 0.0558f; // 0.062 x 0.9 - across, so a 24mm radius at 0.78 // Carried over from the Dvergar's own tuning on this same rig: the face is not flat, so // two eyes placed symmetrically do not come out looking symmetrical. May need a pass in @@ -147,7 +147,22 @@ namespace RacesOfValheim return; } - if (eyes == null) eyes = BuildEyes(headBone); + if (eyes == null) + { + // BuildEyes measures which way the skull faces from the head bone's pose at this + // exact instant (see the frame comment above it) - a one-time reading, cached for + // as long as the eyes exist. Taken while sitting, attached to something, mid-attack + // or asleep, the head can be tilted or turned away from the body's own forward, and + // the snap-to-axis picks whichever axis is closest to THAT pose - which is how eyes + // ended up behind the skull instead of on the face. Waiting for a plain standing + // pose costs nothing (ApplyEyes runs again on the next UpdateColors either way) and + // this is the only place in the whole flow where the timing actually matters. + if (player.IsAttached() || player.IsAttachedToShip() || player.InAttack() || player.IsSleeping()) + { + return; + } + eyes = BuildEyes(headBone); + } if (eyes == null) return; // already logged once by the resolver PlaceEyes(player, headBone, eyes); diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 6d71ec8..51e00a5 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -159,7 +159,19 @@ namespace RacesOfValheim return; } - if (eyes == null) eyes = BuildEyes(player, headBone); + if (eyes == null) + { + // See AswidVisuals.ApplyEyes for the full reasoning - BuildEyes takes a one-time + // reading of the head bone's pose to work out which way the skull faces, and + // caches it for as long as the eyes exist. Sitting, attached, mid-attack or asleep, + // the head can be turned away from the body's own forward at that instant, which is + // how the snap-to-axis picked the wrong side and left the eyes behind the skull. + if (player.IsAttached() || player.IsAttachedToShip() || player.InAttack() || player.IsSleeping()) + { + return; + } + eyes = BuildEyes(player, headBone); + } if (eyes == null) return; // already logged once by the resolver PlaceEyes(player, headBone, eyes);