Merge branch 'fix-aswid-dvergar-eye-placement' into main
Defers the one-time head-orientation measurement for Aswid/Dvergar glow eyes while the player is attached, attached to a ship, mid-attack or asleep, so a bad snapshot no longer leaves the eyes stuck behind the skull. Also shrinks the Aswid's eyes by 10%.
This commit is contained in:
commit
1b2555c5ee
2 changed files with 30 additions and 3 deletions
|
|
@ -68,7 +68,7 @@ namespace RacesOfValheim
|
|||
public static readonly float EyeSeparation = 0.032f; // half the distance between them
|
||||
public static readonly float EyeForward = 0.081f; // centre out from the head bone
|
||||
public static readonly float EyeHeight = 0.181f; // up from the head bone
|
||||
public static readonly float EyeSize = 0.062f; // across, so a 24mm radius at 0.78
|
||||
public static readonly float EyeSize = 0.0558f; // 0.062 x 0.9 - across, so a 24mm radius at 0.78
|
||||
|
||||
// Carried over from the Dvergar's own tuning on this same rig: the face is not flat, so
|
||||
// two eyes placed symmetrically do not come out looking symmetrical. May need a pass in
|
||||
|
|
@ -147,7 +147,22 @@ namespace RacesOfValheim
|
|||
return;
|
||||
}
|
||||
|
||||
if (eyes == null) eyes = BuildEyes(headBone);
|
||||
if (eyes == null)
|
||||
{
|
||||
// BuildEyes measures which way the skull faces from the head bone's pose at this
|
||||
// exact instant (see the frame comment above it) - a one-time reading, cached for
|
||||
// as long as the eyes exist. Taken while sitting, attached to something, mid-attack
|
||||
// or asleep, the head can be tilted or turned away from the body's own forward, and
|
||||
// the snap-to-axis picks whichever axis is closest to THAT pose - which is how eyes
|
||||
// ended up behind the skull instead of on the face. Waiting for a plain standing
|
||||
// pose costs nothing (ApplyEyes runs again on the next UpdateColors either way) and
|
||||
// this is the only place in the whole flow where the timing actually matters.
|
||||
if (player.IsAttached() || player.IsAttachedToShip() || player.InAttack() || player.IsSleeping())
|
||||
{
|
||||
return;
|
||||
}
|
||||
eyes = BuildEyes(headBone);
|
||||
}
|
||||
if (eyes == null) return; // already logged once by the resolver
|
||||
|
||||
PlaceEyes(player, headBone, eyes);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,19 @@ namespace RacesOfValheim
|
|||
return;
|
||||
}
|
||||
|
||||
if (eyes == null) eyes = BuildEyes(player, headBone);
|
||||
if (eyes == null)
|
||||
{
|
||||
// See AswidVisuals.ApplyEyes for the full reasoning - BuildEyes takes a one-time
|
||||
// reading of the head bone's pose to work out which way the skull faces, and
|
||||
// caches it for as long as the eyes exist. Sitting, attached, mid-attack or asleep,
|
||||
// the head can be turned away from the body's own forward at that instant, which is
|
||||
// how the snap-to-axis picked the wrong side and left the eyes behind the skull.
|
||||
if (player.IsAttached() || player.IsAttachedToShip() || player.InAttack() || player.IsSleeping())
|
||||
{
|
||||
return;
|
||||
}
|
||||
eyes = BuildEyes(player, headBone);
|
||||
}
|
||||
if (eyes == null) return; // already logged once by the resolver
|
||||
|
||||
PlaceEyes(player, headBone, eyes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue