fix(dvergar): push the eyes out to the surface of the face

Placement is right and the trace proves it - 0.095m from the head bone, exactly the offsets after the race scale, parented to Head and following it. They were simply still inside the skull, and the shader that resolved is depth-tested, so the head hid them completely.

The bone sits at the base of the skull and a face is further forward than it looks. Offsets raised to land about 0.109m out on a Dvergar. The trace now also reports how far up the eye ended up and whether it is on the face side of the head at all, so the next look distinguishes too shallow from the wrong direction entirely.
This commit is contained in:
kanym 2026-08-05 20:51:11 +02:00
commit e512dcfb93
2 changed files with 15 additions and 4 deletions

View file

@ -281,11 +281,18 @@ namespace RacesOfValheim
if (eye != null)
{
// Which side of the head it came out on. Positive means the face; negative would
// mean the offsets are pushing into the back of the skull, which no amount of
// increasing them would ever fix.
Vector3 offset = eye.position - headBone.position;
Vector3 flat = new Vector3(offset.x, 0f, offset.z);
float towardFace = Vector3.Dot(flat.normalized, player.transform.forward);
Jotunn.Logger.LogInfo(
$"[Dvergar] eye parent='{(eye.parent != null ? eye.parent.name : "none")}' " +
$"localPos={eye.localPosition} localScale={eye.localScale} world={eye.position} " +
$"distFromHead={Vector3.Distance(eye.position, headBone.position):F3}m " +
$"worldSize={eye.lossyScale.x:F3}m");
$"distFromHead={offset.magnitude:F3}m up={offset.y:F3}m " +
$"towardFace={towardFace:F2} worldSize={eye.lossyScale.x:F3}m");
}
}