diff --git a/JotunnModStub/Alfar/AlfarVisuals.cs b/JotunnModStub/Alfar/AlfarVisuals.cs
index c2f2065..e281db9 100644
--- a/JotunnModStub/Alfar/AlfarVisuals.cs
+++ b/JotunnModStub/Alfar/AlfarVisuals.cs
@@ -186,7 +186,23 @@ namespace RacesOfValheim
float size = AlfarConfig.EyeSizeMultiplier.Value;
PlayerFace.AdjustEyes(player, ref height, ref separation, ref size);
- Vector3 baseOffset = frame.LocalForward * AlfarConfig.EyeForward + frame.LocalUp * height;
+ float forward = AlfarConfig.EyeForward;
+ float wrap = AlfarConfig.EyeWrap;
+ float slant = AlfarConfig.EyeSlant;
+ float tilt = 0f;
+ EyePositionConfig.Tuning tuning = EyePositionConfig.For(AlfarConfig.RaceId, player);
+ if (tuning != null)
+ {
+ forward += tuning.Forward.Value;
+ height += tuning.Height.Value;
+ separation += tuning.Separation.Value;
+ size *= tuning.Size.Value;
+ tilt = tuning.RotX;
+ wrap += tuning.RotY;
+ slant += tuning.RotZ;
+ }
+
+ Vector3 baseOffset = frame.LocalForward * forward + frame.LocalUp * height;
Vector3 extent = AlfarConfig.EyeExtent * (size * toLocal);
Quaternion facing = Quaternion.LookRotation(frame.LocalForward, frame.LocalUp);
@@ -200,7 +216,7 @@ namespace RacesOfValheim
Vector3 offset = baseOffset + frame.LocalRight * (side * separation);
eye.localPosition = offset * toLocal;
- eye.localRotation = facing * Quaternion.Euler(0f, AlfarConfig.EyeWrap * side, AlfarConfig.EyeSlant * side);
+ eye.localRotation = facing * Quaternion.Euler(tilt, wrap * side, slant * side);
eye.localScale = extent;
}
}
diff --git a/JotunnModStub/Aswid/AswidVisuals.cs b/JotunnModStub/Aswid/AswidVisuals.cs
index 0402d1e..738170c 100644
--- a/JotunnModStub/Aswid/AswidVisuals.cs
+++ b/JotunnModStub/Aswid/AswidVisuals.cs
@@ -320,8 +320,15 @@ namespace RacesOfValheim
float scale = GetPlayerScale(player) * toLocal;
- Vector3 shift = frame.LocalForward * (AswidConfig.EyeForwardOffset.Value * scale)
- + frame.LocalUp * (AswidConfig.EyeHeightOffset.Value * scale);
+ // The per-body sliders of "Eyes Position - Aswid", on top of the race's own offsets.
+ EyePositionConfig.Tuning tuning = EyePositionConfig.For("Aswid", player);
+ float forward = AswidConfig.EyeForwardOffset.Value + (tuning != null ? tuning.Forward.Value : 0f);
+ float height = AswidConfig.EyeHeightOffset.Value + (tuning != null ? tuning.Height.Value : 0f);
+ float separation = AswidConfig.EyeSeparationOffset.Value + (tuning != null ? tuning.Separation.Value : 0f);
+ float size = AswidConfig.EyeSizeMultiplier.Value * (tuning != null ? tuning.Size.Value : 1f);
+
+ Vector3 shift = frame.LocalForward * (forward * scale)
+ + frame.LocalUp * (height * scale);
for (int i = 0; i < holder.childCount; i++)
{
@@ -344,14 +351,14 @@ 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.
Quaternion twist = Quaternion.Euler(
- AswidConfig.EyeRotationX.Value,
- AswidConfig.EyeRotationY.Value * side,
- AswidConfig.EyeRotationZ.Value);
+ AswidConfig.EyeRotationX.Value + (tuning != null ? tuning.RotX : 0f),
+ (AswidConfig.EyeRotationY.Value + (tuning != null ? tuning.RotY : 0f)) * side,
+ AswidConfig.EyeRotationZ.Value + (tuning != null ? tuning.RotZ * side : 0f));
eye.localPosition = authored.Position + shift +
- frame.LocalRight * (side * AswidConfig.EyeSeparationOffset.Value * scale);
+ frame.LocalRight * (side * separation * scale);
eye.localRotation = twist * authored.Rotation;
- eye.localScale = authored.Scale * AswidConfig.EyeSizeMultiplier.Value;
+ eye.localScale = authored.Scale * size;
}
}
diff --git a/JotunnModStub/ConfigSync.cs b/JotunnModStub/ConfigSync.cs
index abbad38..0f9ac48 100644
--- a/JotunnModStub/ConfigSync.cs
+++ b/JotunnModStub/ConfigSync.cs
@@ -87,6 +87,7 @@ namespace RacesOfValheim
if (section.EndsWith("Keybinds", StringComparison.OrdinalIgnoreCase)) return false;
if (LocalSections.Contains(section, StringComparer.OrdinalIgnoreCase)) return false;
+ if (section.StartsWith(EyePositionConfig.SectionPrefix, StringComparison.OrdinalIgnoreCase)) return false;
if (LocalKeyParts.Any(key.Contains)) return false;
// Model pose nudges (rotation/offset/yaw) are cosmetic, but "Attack Reach Offset" is a
diff --git a/JotunnModStub/Dvergar/DvergarVisuals.cs b/JotunnModStub/Dvergar/DvergarVisuals.cs
index 103f31d..9ca8815 100644
--- a/JotunnModStub/Dvergar/DvergarVisuals.cs
+++ b/JotunnModStub/Dvergar/DvergarVisuals.cs
@@ -283,7 +283,17 @@ namespace RacesOfValheim
float eyeSize = DvergarConfig.EyeSize;
PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize);
- Vector3 baseLocal = localForward * (DvergarConfig.EyeForward * raceScale * toLocal)
+ float forward = DvergarConfig.EyeForward;
+ EyePositionConfig.Tuning tuning = EyePositionConfig.For(DvergarConfig.RaceId, player);
+ if (tuning != null)
+ {
+ forward += tuning.Forward.Value;
+ height += tuning.Height.Value;
+ separation += tuning.Separation.Value;
+ eyeSize *= tuning.Size.Value;
+ }
+
+ Vector3 baseLocal = localForward * (forward * raceScale * toLocal)
+ localUp * (height * raceScale * toLocal);
float eyeLocalSize = eyeSize * raceScale * toLocal;
diff --git a/JotunnModStub/EyePositionConfig.cs b/JotunnModStub/EyePositionConfig.cs
new file mode 100644
index 0000000..bd4a942
--- /dev/null
+++ b/JotunnModStub/EyePositionConfig.cs
@@ -0,0 +1,98 @@
+using System.Collections.Generic;
+using BepInEx.Configuration;
+
+namespace RacesOfValheim
+{
+ ///
+ /// Hand placement for every race that hangs eyes on the face: one "Eyes Position - race"
+ /// section each, with a female and a male set, because the two bodies put their painted eyes
+ /// in different places (PlayerFace). Every value is a delta on the placement the race's own
+ /// code computes, so all zeros (and size 1) is the shipped look.
+ ///
+ /// Local, never synced (ConfigSync): it only changes how this client draws faces.
+ ///
+ public static class EyePositionConfig
+ {
+ public const string SectionPrefix = "Eyes Position - ";
+
+ /// One body's sliders for one race.
+ public sealed class Tuning
+ {
+ public ConfigEntry Forward;
+ public ConfigEntry Height;
+ public ConfigEntry Separation;
+ public ConfigEntry Size;
+
+ // Only bound for races whose eyes are not spheres; null elsewhere.
+ public ConfigEntry RotationX;
+ public ConfigEntry RotationY;
+ public ConfigEntry RotationZ;
+
+ public float RotX => RotationX != null ? RotationX.Value : 0f;
+ public float RotY => RotationY != null ? RotationY.Value : 0f;
+ public float RotZ => RotationZ != null ? RotationZ.Value : 0f;
+ }
+
+ // [race] -> { male, female }
+ private static readonly Dictionary tunings = new Dictionary();
+
+ public static void Bind(ConfigFile config)
+ {
+ BindRace(config, AlfarConfig.RaceId, true);
+ BindRace(config, "Aswid", true);
+ BindRace(config, DvergarConfig.RaceId, false);
+ BindRace(config, SvermConfig.RaceId, false);
+ }
+
+ /// The sliders for the body this player is wearing right now.
+ public static Tuning For(string race, Player player)
+ {
+ if (!tunings.TryGetValue(race, out Tuning[] pair)) return null;
+ return pair[PlayerFace.IsFemale(player) ? 1 : 0];
+ }
+
+ private static void BindRace(ConfigFile config, string race, bool rotation)
+ {
+ string section = SectionPrefix + race;
+ tunings[race] = new[]
+ {
+ BindBody(config, section, "Male", rotation, 100),
+ BindBody(config, section, "Female", rotation, 200),
+ };
+ }
+
+ private static Tuning BindBody(ConfigFile config, string section, string body, bool rotation, int order)
+ {
+ // Female first in the list: Order sorts high to low.
+ Tuning t = new Tuning();
+
+ t.Forward = config.Bind(section, body + " Forward", 0f,
+ new ConfigDescription($"{body} characters: moves both eyes out of (+) or into (-) the face, in metres.",
+ new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 9 }));
+ t.Height = config.Bind(section, body + " Height", 0f,
+ new ConfigDescription($"{body} characters: moves both eyes up (+) or down (-), in metres.",
+ new AcceptableValueRange(-0.05f, 0.05f), new ConfigurationManagerAttributes { Order = order + 8 }));
+ t.Separation = config.Bind(section, body + " Separation", 0f,
+ new ConfigDescription($"{body} characters: pushes the eyes apart (+) or together (-), in metres. Each eye moves by this much.",
+ new AcceptableValueRange(-0.03f, 0.03f), new ConfigurationManagerAttributes { Order = order + 7 }));
+ t.Size = config.Bind(section, body + " Size", 1f,
+ new ConfigDescription($"{body} characters: scales both eyes. 1 is the default size.",
+ new AcceptableValueRange(0.2f, 3f), new ConfigurationManagerAttributes { Order = order + 6 }));
+
+ if (rotation)
+ {
+ t.RotationX = config.Bind(section, body + " Rotation X", 0f,
+ new ConfigDescription($"{body} characters: tilts both eyes up or down, in degrees.",
+ new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 }));
+ t.RotationY = config.Bind(section, body + " Rotation Y", 0f,
+ new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.",
+ new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 4 }));
+ t.RotationZ = config.Bind(section, body + " Rotation Z", 0f,
+ new ConfigDescription($"{body} characters: raises (+) or lowers (-) the outer corners, in degrees. Mirrored between the two eyes.",
+ new AcceptableValueRange(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 3 }));
+ }
+
+ return t;
+ }
+ }
+}
diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs
index f075a97..5eb3b9b 100644
--- a/JotunnModStub/RacesOfValheim.cs
+++ b/JotunnModStub/RacesOfValheim.cs
@@ -56,6 +56,8 @@ namespace RacesOfValheim
// Not a race either: the faction truce and the faction merchants, which cut across
// every race at once, so they bind last rather than inside the alphabetical run above.
FactionsConfig.Bind(Config);
+ // Not a race either: the hand placement of every race's eyes, one section per race.
+ EyePositionConfig.Bind(Config);
// After every Bind above: tags the gameplay entries for Jotunn's server-to-client sync.
ConfigSync.Apply(Config);
harmony.PatchAll();
diff --git a/JotunnModStub/Sverm/SvermVisuals.cs b/JotunnModStub/Sverm/SvermVisuals.cs
index 7dab089..9cb6c82 100644
--- a/JotunnModStub/Sverm/SvermVisuals.cs
+++ b/JotunnModStub/Sverm/SvermVisuals.cs
@@ -256,7 +256,17 @@ namespace RacesOfValheim
float eyeSize = EyeSize;
PlayerFace.AdjustEyes(player, ref height, ref separation, ref eyeSize);
- Vector3 baseLocal = frame.LocalForward * (EyeForward * scale * toLocal)
+ float forward = EyeForward;
+ EyePositionConfig.Tuning tuning = EyePositionConfig.For(SvermConfig.RaceId, player);
+ if (tuning != null)
+ {
+ forward += tuning.Forward.Value;
+ height += tuning.Height.Value;
+ separation += tuning.Separation.Value;
+ eyeSize *= tuning.Size.Value;
+ }
+
+ Vector3 baseLocal = frame.LocalForward * (forward * scale * toLocal)
+ frame.LocalUp * (height * scale * toLocal);
float eyeLocalSize = eyeSize * scale * toLocal;