fix(aswid): eye position sliders rotate on the face's axes

The Eyes Position rotation was added to the Aswid's own twist, which works on
the head bone's raw axes: bone X points out of the face and bone Z sideways,
so Rotation X rolled the eyes and the mirrored Rotation Z tipped one eye up
and the other down. The slider rotation is now conjugated by the face frame,
so X tips, Y turns toward the temple and Z raises the outer corner on both
eyes alike. The female rotation defaults go back to 0, since the old numbers
meant other axes.
This commit is contained in:
kanym 2026-10-27 15:40:52 +01:00
commit ffba40650e
2 changed files with 22 additions and 7 deletions

View file

@ -350,14 +350,30 @@ 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 + (tuning != null ? tuning.RotX : 0f),
(AswidConfig.EyeRotationY.Value + (tuning != null ? tuning.RotY : 0f)) * side,
AswidConfig.EyeRotationZ.Value + (tuning != null ? tuning.RotZ * side : 0f));
AswidConfig.EyeRotationX.Value,
AswidConfig.EyeRotationY.Value * side,
AswidConfig.EyeRotationZ.Value);
// The Eyes Position sliders 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 * separation * scale);
eye.localRotation = twist * authored.Rotation;
eye.localRotation = nudge * twist * authored.Rotation;
eye.localScale = authored.Scale * size;
}
}

View file

@ -44,8 +44,7 @@ namespace RacesOfValheim
BindRace(config, AlfarConfig.RaceId, true,
new Defaults { Separation = 0.006f, RotX = -17.524f });
BindRace(config, "Aswid", true,
new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f,
RotX = -4.543f, RotY = -1.514f, RotZ = -4.543f });
new Defaults { Forward = -0.001f, Height = 0.001f, Separation = 0.006f, Size = 1.061f });
BindRace(config, DvergarConfig.RaceId, false,
new Defaults { Forward = -0.011f, Separation = 0.005f, Size = 1.616f });
BindRace(config, SvermConfig.RaceId, false, new Defaults());
@ -96,7 +95,7 @@ namespace RacesOfValheim
if (rotation)
{
t.RotationX = config.Bind(section, body + " Rotation X", d.RotX,
new ConfigDescription($"{body} characters: tilts both eyes up or down, in degrees.",
new ConfigDescription($"{body} characters: tips both eyes down (+) or up (-), in degrees.",
new AcceptableValueRange<float>(-90f, 90f), new ConfigurationManagerAttributes { Order = order + 5 }));
t.RotationY = config.Bind(section, body + " Rotation Y", d.RotY,
new ConfigDescription($"{body} characters: turns the eyes toward the temples (+) or the nose (-), in degrees. Mirrored between the two eyes.",