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:
parent
20c12724fd
commit
ffba40650e
2 changed files with 22 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue