diff --git a/JotunnModStub/Alfar/AlfarConfig.cs b/JotunnModStub/Alfar/AlfarConfig.cs index 1769a1a..558c0a7 100644 --- a/JotunnModStub/Alfar/AlfarConfig.cs +++ b/JotunnModStub/Alfar/AlfarConfig.cs @@ -39,17 +39,26 @@ namespace RacesOfValheim public static ConfigEntry WidthScale; /// - /// 1 is the Sverm's size, which is what the design asked to try first ("se non va li - /// allarghiamo"). Raise it to enlarge the eyes: 1.6 is roughly a grey from the films. + /// Scales the almond eyes (EyeExtent). The default 0.8 is the tuned grey look; raise it for + /// bigger eyes. /// public static ConfigEntry EyeSizeMultiplier; - // The eye geometry is the Sverm's, unchanged (SvermVisuals): offsets are metres in the head - // bone's OWN frame, so they land on the same part of the face at any body scale. - public const float EyeSeparation = 0.032f; - public const float EyeForward = 0.081f; - public const float EyeHeight = 0.181f; - public const float EyeSize = 0.062f; + // A grey's eyes, on the Sverm's eye spot: offsets are metres in the head bone's OWN frame + // at human scale, so they land on the same part of the face at any body scale. + // Pushed apart and forward of the Sverm's, because an almond this wide would otherwise + // meet its twin over the nose and sink into the cheek. + public const float EyeSeparation = 0.037f; + public const float EyeForward = 0.090f; + public const float EyeHeight = 0.183f; + + // Full width, height and depth of one eye in metres at Eye Size Multiplier 1. The saved + // default of 0.8 makes that 50 x 28 x 18 mm. + public static readonly Vector3 EyeExtent = new Vector3(0.0625f, 0.035f, 0.0225f); + + // Degrees. Slant raises the outer corner; wrap turns each eye out toward its temple. + public const float EyeSlant = 22f; + public const float EyeWrap = 20f; // ─── Eitr: diet, shield, soft fall ─────────────────────────────────── @@ -152,7 +161,7 @@ namespace RacesOfValheim new AcceptableValueRange(0.7f, 1.2f))); EyeSizeMultiplier = config.Bind(look, "Eye Size Multiplier", 0.8f, - new ConfigDescription("1 = the Sverm's eye size; 0.8 is slightly smaller. Raise to enlarge the black eyes.", + new ConfigDescription("Scales the black almond eyes. 0.8 is the default look; raise it for bigger eyes.", new AcceptableValueRange(0.5f, 3f))); } } diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs index 51d4cd1..aa6df6e 100644 --- a/JotunnModStub/Alfar/AlfarVisuals.cs +++ b/JotunnModStub/Alfar/AlfarVisuals.cs @@ -161,35 +161,67 @@ namespace RacesOfValheim } if (eyes == null) return; - PlaceEyes(headBone, eyes); + PlaceEyes(player, eyes); } - private static void PlaceEyes(Transform headBone, Transform holder) + /// + /// A grey's eyes: wide black almonds, outer corners raised, wrapping round the sides of the + /// face. Each is a sphere squashed to an ellipsoid and turned in the skull's own frame. + /// + /// FIXED HEAD-LOCAL UNITS, never headBone.lossyScale. The Alfar Visual is scaled + /// non-uniformly, so the head's lossyScale is only an approximation that changes as the + /// head turns; recomputed on the 0.5s cosmetic pass it made the eyes trail the face. The + /// face is skinned to the same bone through the same matrices, so a constant local offset + /// stays glued to it at any body scale, and PlaceEyes only has to run when the eyes change. + /// + private static void PlaceEyes(Player player, Transform holder) { - Vector3 lossy = headBone.lossyScale; - if (Mathf.Abs(lossy.x) < 0.0001f || Mathf.Abs(lossy.y) < 0.0001f || Mathf.Abs(lossy.z) < 0.0001f) return; - EyeFrame frame = holder.GetComponent(); if (frame == null) return; - // The Visual is scaled non-uniformly (thinner than tall), so lossyScale has three - // different components and a single divisor would squash the spheres. Each axis is - // divided by its own. - Vector3 toLocal = new Vector3(1f / lossy.x, 1f / lossy.y, 1f / lossy.z); - float eyeSize = AlfarConfig.EyeSize * AlfarConfig.EyeSizeMultiplier.Value; + const float toLocal = PlayerFace.MetresToHeadLocal; - Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * AlfarConfig.EyeHeight; + float height = AlfarConfig.EyeHeight; + float separation = AlfarConfig.EyeSeparation; + float size = AlfarConfig.EyeSizeMultiplier.Value; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref size); + + Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp); for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); - // Index 0 is offset against the right axis, so it is the model's left eye. + // Index 0 is offset against the right axis, so it is the model's left eye. The + // slant and the wrap are mirrored so both outer corners go up and back. float side = i == 0 ? -1f : 1f; - Vector3 offset = baseOffset + frame.LocalRight * (side * AlfarConfig.EyeSeparation); - eye.localPosition = Vector3.Scale(offset, toLocal); - eye.localScale = Vector3.Scale(Vector3.one * eyeSize, toLocal); + // This eye's hand corrections (RaceEyeTuning). + float forward = AlfarConfig.EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float eyeSize = size; + float wrap = AlfarConfig.EyeWrap; + float slant = AlfarConfig.EyeSlant; + float tilt = 0f; + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(AlfarConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + eyeSize *= tuning.Size; + tilt = tuning.RotX; + wrap += tuning.RotY; + slant += tuning.RotZ; + } + + Vector3 offset = frame.LocalForward * forward + frame.LocalUp * eyeHeight + + frame.LocalRight * (side * eyeSeparation); + + eye.localPosition = offset * toLocal; + eye.localRotation = facing * Quaternion.Euler(tilt, wrap * side, slant * side); + eye.localScale = AlfarConfig.EyeExtent * (eyeSize * toLocal); } } @@ -234,9 +266,8 @@ namespace RacesOfValheim } /// - /// Matte black, and nothing else: the colour is black, the emission is black, and the two - /// properties that make a lit shader shine are zeroed where the shader has them. The - /// Sverm's eyes burn; these must read as holes. + /// Black with a wet sheen: no emission, but smooth enough to catch a highlight, which is + /// what makes a grey's eyes read as eyes and not as two holes punched in the face. /// private static Material BlackMaterial(Shader shader) { @@ -244,10 +275,9 @@ namespace RacesOfValheim material.color = Color.black; if (material.HasProperty("_EmissionColor")) material.SetColor("_EmissionColor", Color.black); - if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0f); - if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0f); + if (material.HasProperty("_Glossiness")) material.SetFloat("_Glossiness", 0.8f); + if (material.HasProperty("_Smoothness")) material.SetFloat("_Smoothness", 0.8f); if (material.HasProperty("_Metallic")) material.SetFloat("_Metallic", 0f); - if (material.HasProperty("_SpecColor")) material.SetColor("_SpecColor", Color.black); return material; } diff --git a/JotunnModStub/Aswid/AswidConfig.cs b/JotunnModStub/Aswid/AswidConfig.cs index 1cf197b..ee02779 100644 --- a/JotunnModStub/Aswid/AswidConfig.cs +++ b/JotunnModStub/Aswid/AswidConfig.cs @@ -453,7 +453,7 @@ namespace RacesOfValheim new ConfigDescription("As above, around the third axis. The default half turn is what rights the borrowed socket, which arrives upside down on a player's head bone.", new AcceptableValueRange(-180f, 180f), new ConfigurationManagerAttributes { Order = 58 })); - EyeSmoke = config.Bind(eyes, "Eye Smoke", true, + EyeSmoke = config.Bind(eyes, "Eye Smoke", false, new ConfigDescription("Lights the smoke the creature carries inside its own sockets and leaves switched off. Tinted to match the eyes, so it turns with them at the last stage.", null, new ConfigurationManagerAttributes { Order = 50 })); EyeFlatColorShader = config.Bind(eyes, "Eye Flat Colour Shader", false, diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs index b118424..c0822ad 100644 --- a/JotunnModStub/Aswid/AswidVisuals.cs +++ b/JotunnModStub/Aswid/AswidVisuals.cs @@ -58,6 +58,12 @@ namespace RacesOfValheim private const float BaseEyeHeight = 0.181f; private const float BaseEyeSeparation = 0.032f; + // The borrowed socket at the size the Skeleton wears it, times the config multiplier, was + // two green blocks on the face; at half it was smaller than the painted eye underneath, + // which then showed round it. Applied before the multiplier, so a saved config keeps its + // meaning as "relative to the default". + private const float BaseEyeScale = 0.75f; + // ─── Race check ───────────────────────────────────────────────────── /// @@ -99,6 +105,10 @@ namespace RacesOfValheim // built again rather than merely moved. public string SourceModel = ""; public bool FlatShader; + + // Which body the base pose was measured for: the female face puts the eyes elsewhere + // (PlayerFace), so a change of body model is a rebuild too. + public bool Female; } /// The pose an eye was authored at on the creature. Everything else is a delta on this. @@ -180,7 +190,8 @@ namespace RacesOfValheim EyeFrame existing = eyes.GetComponent(); if (existing == null || existing.SourceModel != AswidConfig.EyeSourceModel.Value || - existing.FlatShader != AswidConfig.EyeFlatColorShader.Value) + existing.FlatShader != AswidConfig.EyeFlatColorShader.Value || + existing.Female != PlayerFace.IsFemale(player)) { eyes.name = EyesName + "_Removed"; Object.Destroy(eyes.gameObject); @@ -309,9 +320,6 @@ namespace RacesOfValheim float scale = GetPlayerScale(player) * toLocal; - Vector3 shift = frame.LocalForward * (AswidConfig.EyeForwardOffset.Value * scale) - + frame.LocalUp * (AswidConfig.EyeHeightOffset.Value * scale); - for (int i = 0; i < holder.childCount; i++) { Transform eye = holder.GetChild(i); @@ -324,6 +332,16 @@ namespace RacesOfValheim float side = Mathf.Sign(Vector3.Dot(authored.Position, frame.LocalRight)); if (side == 0f) side = i == 0 ? -1f : 1f; + // This eye's hand corrections (RaceEyeTuning), on top of the race's own offsets. + RaceEyeTuning.Eye tuning = RaceEyeTuning.For("Aswid", player, side); + float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward : 0f); + float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height : 0f); + float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation : 0f); + float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size : 1f); + + Vector3 shift = frame.LocalForward * (forward * scale) + + frame.LocalUp * (height * scale); + // YAW IS MIRRORED, the other two are not. Turning both eyes the same way on Y // makes the pair look sideways - both point off the same shoulder, because a face // is symmetric about its centre line and yaw is the axis that crosses it. Negating @@ -332,15 +350,31 @@ namespace RacesOfValheim // // Pitch and roll are shared deliberately: both eyes looking up is a face looking // up, and mirroring either of those would cross them instead of aiming them. + // + // This twist is on the HEAD BONE's raw axes (it multiplies from the left), and on + // this rig those are not the face's: bone X points out of the face and bone Z + // sideways. The defaults were dialled in against that, so it stays as it is. Quaternion twist = Quaternion.Euler( AswidConfig.EyeRotationX.Value, AswidConfig.EyeRotationY.Value * side, AswidConfig.EyeRotationZ.Value); + // The RaceEyeTuning corrections turn the eye on the FACE's axes instead: conjugated by + // the face frame, X tips it, Y turns it toward the temple and Z raises the outer + // corner, the same on both eyes. Added to the bone-axis twist above, X rolled the + // eyes and a mirrored Z tipped one up and the other down. + Quaternion nudge = Quaternion.identity; + if (tuning != null) + { + nudge = authored.Rotation + * Quaternion.Euler(tuning.RotX, tuning.RotY * side, tuning.RotZ * side) + * Quaternion.Inverse(authored.Rotation); + } + eye.localPosition = authored.Position + shift + - frame.LocalRight * (side * AswidConfig.EyeSeparationOffset.Value * scale); - eye.localRotation = twist * authored.Rotation; - eye.localScale = authored.Scale * AswidConfig.EyeSizeMultiplier.Value; + frame.LocalRight * (side * separation * scale); + eye.localRotation = nudge * twist * authored.Rotation; + eye.localScale = authored.Scale * size; } } @@ -424,6 +458,12 @@ namespace RacesOfValheim MeasureFrame(player, headBone, frame); frame.SourceModel = modelName; frame.FlatShader = AswidConfig.EyeFlatColorShader.Value; + frame.Female = PlayerFace.IsFemale(player); + + float baseHeight = BaseEyeHeight; + float baseSeparation = BaseEyeSeparation; + float baseSize = BaseEyeScale; + PlayerFace.AdjustEyes(player, ref baseHeight, ref baseSeparation, ref baseSize); // canonicalToFrame turns "face forward, as authored" into "face forward, on THIS // rig's own axes" - the rotation that carries the ordinary (X,Y,Z) convention onto @@ -458,8 +498,8 @@ namespace RacesOfValheim float toLocal = 1f / headBone.lossyScale.x; Vector3 basePosition = frame.LocalForward * (BaseEyeForward * toLocal) - + frame.LocalUp * (BaseEyeHeight * toLocal) - + frame.LocalRight * (side * BaseEyeSeparation * toLocal); + + frame.LocalUp * (baseHeight * toLocal) + + frame.LocalRight * (side * baseSeparation * toLocal); // The socket's own authored tilt is skipped for the same reason its position is - // canonicalToFrame alone (face forward, on this rig's axes) is what the config's @@ -481,7 +521,7 @@ namespace RacesOfValheim // this object at on a real skeleton. Divided into the new parent's scale, the pair // lands at exactly the size vanilla wears them, which is the whole point of // borrowing them instead of drawing spheres. - Vector3 baseScale = source.lossyScale * toLocal; + Vector3 baseScale = source.lossyScale * (toLocal * baseSize); // Remembered before anything moves it, because everything the config does is // expressed as a delta on this. diff --git a/JotunnModStub/Dvergar/DvergarConfig.cs b/JotunnModStub/Dvergar/DvergarConfig.cs index 745c748..03f0bad 100644 --- a/JotunnModStub/Dvergar/DvergarConfig.cs +++ b/JotunnModStub/Dvergar/DvergarConfig.cs @@ -124,9 +124,11 @@ namespace RacesOfValheim // still clearing by about 2mm. Same size of eye, sitting deeper, and the cap is flatter // for it - which is what reads as set into the skull rather than resting on it. public static readonly float EyeSeparation = 0.032f; // half the distance between them - public static readonly float EyeForward = 0.081f; // centre ~63mm out + public static readonly float EyeForward = 0.085f; // 0.081 left the smaller ball buried public static readonly float EyeHeight = 0.181f; // ~15mm lower than before - public static readonly float EyeSize = 0.062f; // ~48mm across, so a 24mm radius + // Then cut down after playtest: at 0.062 the cap read as two lamps covering the face. An + // 18mm radius at the same depth leaves a cap of about 22mm on a 0.78 Dvergar. + public static readonly float EyeSize = 0.036f; // How hard the eyes burn. The colours the game gives a starred dverger are HDR - one star // is (0, 4, 3.3) - and anything past 1 clips to white on the way to the bloom pass, which diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs index a6a694a..c654a3a 100644 --- a/JotunnModStub/Dvergar/DvergarVisuals.cs +++ b/JotunnModStub/Dvergar/DvergarVisuals.cs @@ -277,10 +277,11 @@ namespace RacesOfValheim // 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 = localForward * (DvergarConfig.EyeForward * raceScale * toLocal) - + localUp * (DvergarConfig.EyeHeight * raceScale * toLocal); - float eyeLocalSize = DvergarConfig.EyeSize * raceScale * toLocal; + float height = DvergarConfig.EyeHeight; + float separation = DvergarConfig.EyeSeparation; + float eyeSize = DvergarConfig.EyeSize; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); for (int i = 0; i < holder.childCount; i++) { @@ -291,9 +292,25 @@ namespace RacesOfValheim // curved and the two sides do not present the same surface to a ball of this // radius. float side = i == 0 ? -1f : 1f; - float size = i == 0 ? eyeLocalSize * DvergarConfig.LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + localRight * (side * DvergarConfig.EyeSeparation * raceScale * toLocal); + // This eye's hand corrections (RaceEyeTuning). + float forward = DvergarConfig.EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float size = eyeSize * raceScale * toLocal; + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(DvergarConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + size *= tuning.Size; + } + if (i == 0) size *= DvergarConfig.LeftEyeSizeMultiplier; + + eye.localPosition = localForward * (forward * raceScale * toLocal) + + localUp * (eyeHeight * raceScale * toLocal) + + localRight * (side * eyeSeparation * raceScale * toLocal); eye.localScale = Vector3.one * size; } } diff --git a/JotunnModStub/PlayerFace.cs b/JotunnModStub/PlayerFace.cs new file mode 100644 index 0000000..4c6b39f --- /dev/null +++ b/JotunnModStub/PlayerFace.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace RacesOfValheim +{ + /// + /// Where a player's painted eyes are, for the races that hang something over them (Alfar, + /// Aswid, Dvergar, Sverm). + /// + /// Every eye constant in this mod (0.081 forward, 0.181 up, 0.032 apart) was tuned on the MALE + /// body. The female body is a different mesh on the same rig and the same skin texture, and it + /// maps the painted eyes elsewhere: read offline from VisEquipment.m_models (bodymale vs + /// bodyfem, Valheim 1.0.20), by finding the dark socket pixels of PlayerCharacter_01 and + /// following the UVs back onto each mesh in head-bone space, the female eyes sit about 6mm + /// lower and a quarter closer together. Both are weighted 100% to Head, so once placed they + /// follow the head exactly; a sphere on the male spot simply sits on the brow, off the face. + /// + /// HEAD-LOCAL UNITS. The player armature is authored at 100x, so one metre at human scale is + /// 0.01 in the head bone's own space. That is a constant of the rig, not of this frame: + /// reading headBone.lossyScale live instead breaks under a non-uniform body scale (the Alfar), + /// where the value drifts as the head turns. + /// + public static class PlayerFace + { + public const float MetresToHeadLocal = 0.01f; + + // Female against male. The UV reading gave -6mm, but in game the eyes still sat a full + // eye-height above the painted ones on every race (screenshots, 2026-10-27), so the + // height is the measured shift plus that. + private const float FemaleHeightShift = -0.014f; + private const float FemaleSeparationScale = 0.75f; + private const float FemaleSizeScale = 0.9f; + + /// True while the body wears the female mesh (VisEquipment model index 1). + public static bool IsFemale(Player player) + { + VisEquipment vis = player != null ? player.GetComponent() : null; + if (vis == null || vis.m_bodyModel == null || vis.m_models == null || vis.m_models.Length < 2) return false; + return vis.m_bodyModel.sharedMesh == vis.m_models[1].m_mesh; + } + + /// Moves male-tuned eye numbers (metres) onto the female face; leaves a male face alone. + public static void AdjustEyes(Player player, ref float height, ref float separation, ref float size) + { + if (!IsFemale(player)) return; + + height += FemaleHeightShift; + separation *= FemaleSeparationScale; + size *= FemaleSizeScale; + } + } +} diff --git a/JotunnModStub/RaceEyeTuning.cs b/JotunnModStub/RaceEyeTuning.cs new file mode 100644 index 0000000..ea55567 --- /dev/null +++ b/JotunnModStub/RaceEyeTuning.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace RacesOfValheim +{ + /// + /// Hand corrections for every race that hangs eyes on the face, per body and per eye. Per body + /// because the two bodies put their painted eyes in different places (PlayerFace); per eye + /// because the face is not symmetric enough for one set to fit both. Left and right are the + /// character's own. + /// + /// Every value is a delta on the placement the race's own code computes: zeros (and size 1) + /// change nothing. They were dialled in on screen with Configuration Manager sliders + /// (playtest, 2026-10-27) and then written down here; the sliders are gone. + /// + public static class RaceEyeTuning + { + /// One eye's corrections. Metres for the offsets, degrees for the rotations. + public sealed class Eye + { + public float Forward, Height, Separation, RotX, RotY, RotZ; + public float Size = 1f; + } + + private static readonly Eye Untouched = new Eye(); + + // [race] -> { male left, male right, female left, female right } + private static readonly Dictionary tunings = new Dictionary + { + [AlfarConfig.RaceId] = new[] + { + new Eye(), + new Eye { Separation = 0.009f }, + new Eye { Separation = 0.006f, RotX = -17.524f }, + new Eye { Separation = 0.015f, RotX = -17.524f }, + }, + ["Aswid"] = new[] + { + new Eye { Height = -0.005f, Separation = -0.005f, Size = 1.273f, RotX = 6.49f, RotY = 4.544f, RotZ = 4.544f }, + new Eye { Forward = -0.002f, Height = -0.005f, Separation = 0.004f, Size = 1.444f, RotZ = 6.49f }, + new Eye { Forward = -0.006f, Height = -0.010f, Size = 1.314f, RotX = -14.279f, RotY = -5.841f, RotZ = -1.298f }, + new Eye { Forward = -0.006f, Height = -0.012f, Separation = 0.011f, Size = 1.324f, RotX = 1.947f, RotY = 3.245f, RotZ = 4.544f }, + }, + [DvergarConfig.RaceId] = new[] + { + new Eye { Forward = -0.003f, Size = 1.05f }, + new Eye { Forward = -0.004f, Separation = 0.005f }, + new Eye { Forward = -0.011f, Separation = 0.005f, Size = 1.616f }, + new Eye { Forward = -0.015f, Separation = 0.013f, Size = 1.616f }, + }, + // The Sverm's helmet hides its eyes, so it keeps the code's own placement. + }; + + /// + /// The corrections for one eye of the body this player is wearing right now. Side is the + /// races' own convention: negative is offset against the head frame's right axis, which is + /// the character's left eye. Never null. + /// + public static Eye For(string race, Player player, float side) + { + if (!tunings.TryGetValue(race, out Eye[] set)) return Untouched; + return set[(PlayerFace.IsFemale(player) ? 2 : 0) + (side < 0f ? 0 : 1)]; + } + } +} diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs index f39e3ca..dd18e5d 100644 --- a/JotunnModStub/Sverm/SvermVisuals.cs +++ b/JotunnModStub/Sverm/SvermVisuals.cs @@ -251,10 +251,10 @@ namespace RacesOfValheim float scale = player.transform.localScale.x; - Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal) - + frame.LocalUp * (EyeHeight * scale * toLocal); - - float eyeLocalSize = EyeSize * scale * toLocal; + float height = EyeHeight; + float separation = EyeSeparation; + float eyeSize = EyeSize; + PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize); for (int i = 0; i < holder.childCount; i++) { @@ -262,9 +262,25 @@ namespace RacesOfValheim // Index 0 is offset against the right axis, so it is the model's left eye. float side = i == 0 ? -1f : 1f; - float size = i == 0 ? eyeLocalSize * LeftEyeSizeMultiplier : eyeLocalSize; - eye.localPosition = baseLocal + frame.LocalRight * (side * EyeSeparation * scale * toLocal); + // This eye's hand corrections (RaceEyeTuning). + float forward = EyeForward; + float eyeHeight = height; + float eyeSeparation = separation; + float size = eyeSize * scale * toLocal; + RaceEyeTuning.Eye tuning = RaceEyeTuning.For(SvermConfig.RaceId, player, side); + if (tuning != null) + { + forward += tuning.Forward; + eyeHeight += tuning.Height; + eyeSeparation += tuning.Separation; + size *= tuning.Size; + } + if (i == 0) size *= LeftEyeSizeMultiplier; + + eye.localPosition = frame.LocalForward * (forward * scale * toLocal) + + frame.LocalUp * (eyeHeight * scale * toLocal) + + frame.LocalRight * (side * eyeSeparation * scale * toLocal); eye.localScale = Vector3.one * size; } }