fix(skeleton): put the jaw mapping back, and dim the head flame

The log settled it. All three skeleton models share one rig - 53 bones each, a
bone named Jaw in every one, and not a single bone falling through to the root -
which means the player rig has a real Jaw bone and the plain name match was
landing on it correctly all along. That is why the plain and poison skeletons
always looked right, and why pinning the skull group to the head deformed them.
Reverted; the parent walk stays for bones that genuinely match nothing.

Which leaves the real question: three models, one rig, one mapping, and only
Hildir wears its jaw wrongly. The difference has to be in how that jaw is posed
or bound rather than where it is mapped, so the diagnostic now prints the rest
transform of every skull bone alongside the player's own. One session loading a
working model and the broken one gives the exact correction instead of a third
guess at it.

The flame works - it resolved to the torch - but at 1.8 it was a white-hot bloom
that washed out the screen and hid the skull underneath, which is no way to judge
a jaw. Down to 1.1, with the torch light cut further.
This commit is contained in:
kanym 2026-08-05 17:47:46 +02:00
commit d9b87e97f0
2 changed files with 30 additions and 20 deletions

View file

@ -402,11 +402,10 @@ namespace RacesOfValheim
catch (System.Exception e) { }
}
// Parts of a skull that must ride the head as one piece. A creature's jaw is authored
// against its own skull, so binding it to a same-named bone on the player - or letting
// it fall through to the root - puts the mandible somewhere near the face rather than
// on it. Pinning the whole group to the head keeps the skull in one piece; the jaw
// stops being able to open, which is a fair trade for it being attached.
// Bones worth reporting on. Not remapped - the player rig has a real 'Jaw' bone and the
// name match lands on it correctly, which is exactly why the plain and poison skeletons
// always looked right. An earlier attempt pinned this group to the head instead and
// deformed all three models; the log is what settled it.
private static readonly string[] SkullParts = { "jaw", "teeth", "tooth", "tongue", "chin", "mandible" };
/// <summary>
@ -416,16 +415,6 @@ namespace RacesOfValheim
{
if (sourceBone == null) return playerBones[0];
string name = sourceBone.name.ToLower();
foreach (string part in SkullParts)
{
if (!name.Contains(part)) continue;
Transform head = FindBoneByName(playerBones, "Head");
if (head != null) return head;
break;
}
Transform direct = FindBoneByName(playerBones, sourceBone.name);
if (direct != null) return direct;
@ -470,10 +459,30 @@ namespace RacesOfValheim
if (!interesting && !isRootFallback) continue;
// The rest pose comes with it. Three models share this rig bone for bone, yet
// only one of them wears its jaw wrongly - so the difference is in how that
// jaw is posed or bound, not in where it is mapped. Printing the source
// transform next to the player's own gives the exact correction to apply
// rather than another guess at it.
Transform playerEquivalent = FindBoneByName(playerBones, bone.name);
Jotunn.Logger.LogInfo(
$"[Skeleton] '{bone.name}' -> '{(resolved != null ? resolved.name : "null")}'" +
(isRootFallback ? " (ROOT FALLBACK)" : "") +
(interesting ? " (skull part)" : ""));
if (!interesting) continue;
Jotunn.Logger.LogInfo(
$"[Skeleton] source rest: pos={bone.localPosition:F4} " +
$"rot={bone.localRotation.eulerAngles:F2} scale={bone.localScale:F3}");
if (playerEquivalent != null)
{
Jotunn.Logger.LogInfo(
$"[Skeleton] player rest: pos={playerEquivalent.localPosition:F4} " +
$"rot={playerEquivalent.localRotation.eulerAngles:F2} scale={playerEquivalent.localScale:F3}");
}
}
}

View file

@ -63,9 +63,10 @@ namespace RacesOfValheim
// Above the head bone's own origin, which sits at the base of the skull.
private const float HeadFlameHeight = 0.18f;
// Torch flames are authored for a fist-sized fire on a stick. This is the two knobs to
// turn if the skull ends up wearing a bonfire or a birthday candle.
private const float HeadFlameScale = 1.8f;
// Torch flames are authored for a fist-sized fire on a stick. 1.8 turned the head into a
// white-hot bloom that washed out the whole screen - and, more to the point, hid the skull
// underneath it. This is the knob to turn if it still burns too bright or too small.
private const float HeadFlameScale = 1.1f;
// Fire sources in preference order. The torch is an item every world has; the ground
// torch and the fire pit are the building pieces to fall back on.
@ -476,8 +477,8 @@ namespace RacesOfValheim
// blows out the whole face. Keep the glow, lose the floodlight.
foreach (Light light in headFlameVFX.GetComponentsInChildren<Light>(true))
{
light.range *= 0.5f;
light.intensity *= 0.6f;
light.range *= 0.35f;
light.intensity *= 0.4f;
}
// Anything that made the source a torch rather than a fire.