diff --git a/JotunnModStub/Dvergar/DvergarConfig.cs b/JotunnModStub/Dvergar/DvergarConfig.cs index 3fa0c72..6078c2d 100644 --- a/JotunnModStub/Dvergar/DvergarConfig.cs +++ b/JotunnModStub/Dvergar/DvergarConfig.cs @@ -87,22 +87,17 @@ namespace RacesOfValheim // instead. Nothing else in the mod does this, so there was no working example to copy; // the Aswid's red eyes were never built at all, only cleaned up. // - // These are adjustments in metres on top of a measured starting point, not absolute - // offsets from a bone. The eyes are parented to the head bone and placed at whatever - // Character.m_eye works out to in that bone's local space - the game's own answer to - // where this player's eyes are - so the numbers below only have to nudge, and everything - // rides the head animation because it is expressed in the head's own coordinates. + // Metres from the head bone, which sits at the base of the skull, along the player's own + // forward and up. The eyes are parented to that bone, so all of this rides the head + // animation, and every offset scales with the race. // - // Two earlier attempts guessed instead, and both failed in an instructive way: parented - // to m_eye the eyes floated a foot above a shrunken Dvergar, because m_eye is the - // camera's anchor and lives outside the scaled rig; placed from the player root's axes - // they ignored the head entirely and read as stuck to the camera. - // - // EyeForward pushes them out of the skull to the surface of the face - it is the one that - // matters. All of them scale with the race. + // Do not reintroduce Character.m_eye as a starting point. It reads like the right + // reference and is not: it is where the camera goes, half a metre above the head bone, + // and starting from it put the eyes in the treetops. That was measured, not guessed - + // the trace is in the commit history. public static readonly float EyeSeparation = 0.032f; // half the distance between them - public static readonly float EyeForward = 0.070f; - public static readonly float EyeHeight = 0.000f; + public static readonly float EyeForward = 0.095f; + public static readonly float EyeHeight = 0.070f; public static readonly float EyeSize = 0.020f; // Base glow, before any star. The tiers replace it with the emissive colours the game diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index 3dea9d8..ffdac13 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -227,17 +227,19 @@ namespace RacesOfValheim // Metres -> the head bone's local units, which the armature authors at roughly 100x. float toLocal = 1f / lossy; - Vector3 localEye = player.m_eye != null - ? headBone.InverseTransformPoint(player.m_eye.position) - : Vector3.zero; - Vector3 localForward = headBone.InverseTransformDirection(root.forward).normalized; Vector3 localUp = headBone.InverseTransformDirection(root.up).normalized; Vector3 localRight = headBone.InverseTransformDirection(root.right).normalized; + // Measured from the head bone itself, and from nothing else. + // + // The previous version started from Character.m_eye, on the reasoning that it is the + // game's own answer to where a player's eyes are. It is not - it is where the camera + // goes, and the trace showed it sitting 0.51m straight above the head bone. That half + // metre was the entire drift: the offsets below are under a centimetre in local units + // and never stood a chance of mattering next to it. float raceScale = GetVisualScale(player); - Vector3 baseLocal = localEye - + localForward * (DvergarConfig.EyeForward * raceScale * toLocal) + Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal) + localUp * (DvergarConfig.EyeHeight * raceScale * toLocal); float eyeLocalSize = DvergarConfig.EyeSize * raceScale * toLocal;