feat(eyes): per-race eye position sliders in Configuration Manager

One 'Eyes Position - <race>' section each for the Alfar, Aswid, Dvergar and
Sverm, with a female and a male set: forward, height, separation and size,
plus rotation X/Y/Z for the Alfar and Aswid. All are deltas on the computed
placement (0 and size 1 change nothing), read live, and left local by
ConfigSync because they only change how this client draws faces.
This commit is contained in:
kanym 2026-10-27 15:21:19 +01:00
commit 8b2b5180ed
7 changed files with 155 additions and 11 deletions

View file

@ -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;
}
}