From e6bf266eea01746c1ba6366fead31ff3fc442a70 Mon Sep 17 00:00:00 2001 From: kanym Date: Wed, 5 Aug 2026 21:54:26 +0200 Subject: [PATCH] fix(dvergar): derive the sideways axis so both eyes sit at the same depth One eye reading correctly while the other creeps up the forehead is what an out-of-square frame looks like. The three axes were each rounded to the nearest one independently, which guarantees nothing about the angles between them - and a right that shares an axis with forward is no longer sideways, so the separation pushes one eye out of the face and pulls the other into it. Right is now a cross product of the other two, which cannot be anything but perpendicular to both. Symmetric by construction rather than by luck of the pose the head was in when the eyes were built. --- JotunnModStub/Dvergar/DvergarVisuals.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 8866589..50c2344 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -318,7 +318,13 @@ namespace RacesOfValheim EyeFrame frame = holder.AddComponent(); frame.LocalForward = SnapToAxis(headBone.InverseTransformDirection(root.forward)); frame.LocalUp = SnapToAxis(headBone.InverseTransformDirection(root.up)); - frame.LocalRight = SnapToAxis(headBone.InverseTransformDirection(root.right)); + + // Right is derived, never snapped. Rounding all three independently guarantees + // nothing about the angles between them, and a "right" that shares an axis with + // forward stops being sideways: the separation then pushes one eye out of the face + // and pulls the other into it, which is one eye sitting proud of a forehead while its + // twin sits correctly. A cross product cannot be anything but perpendicular. + frame.LocalRight = Vector3.Cross(frame.LocalUp, frame.LocalForward).normalized; for (int i = 0; i < 2; i++) {