From fc6cd4f4d45ced83ef0a7b41fbc45d3ade533398 Mon Sep 17 00:00:00 2001 From: kanym Date: Fri, 7 Aug 2026 10:13:00 +0200 Subject: [PATCH] fix(skeleton): stop the burning skull's torch clone falling off The head-flame VFX clones only the source torch's ParticleSystem subtree, then stripped components with a blocklist (every MonoBehaviour, every Collider) to leave a bare flame. The blocklist missed Rigidbody - not a MonoBehaviour in Unity - so a torch whose fire-particle node carried one kept being acted on by physics independently of the parent GameObject that tracks the head each frame, and visibly fell away from the skull. Switched to an allowlist: keep only Transform/ParticleSystem/ ParticleSystemRenderer/Light, destroy everything else on the clone. Can't miss a component type this way, whatever it turns out to be next. --- JotunnModStub/Skeleton/SkeletonVisuals.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/JotunnModStub/Skeleton/SkeletonVisuals.cs b/JotunnModStub/Skeleton/SkeletonVisuals.cs index 1c5f41e..d4ec7c0 100644 --- a/JotunnModStub/Skeleton/SkeletonVisuals.cs +++ b/JotunnModStub/Skeleton/SkeletonVisuals.cs @@ -213,15 +213,21 @@ namespace RacesOfValheim light.intensity *= 0.6f; } - // Anything that made the source a torch rather than a fire. - foreach (MonoBehaviour comp in m_instance.GetComponentsInChildren(true)) + // Allowlist, not a blocklist: keep only what a pure VFX actually needs (the + // particle systems, their renderers, and the light tweaked above) and destroy + // every other component, whatever it turns out to be. A blocklist of "known bad" + // types (MonoBehaviour, Collider) missed Rigidbody - not a MonoBehaviour in Unity, + // so the old loop never touched it - and a torch's fire-particle node carrying one + // meant physics kept acting on the clone independently of m_instance being + // repositioned onto the head every frame: it visibly fell away while the empty + // parent stayed correctly tracked above it. Anything that made the source a torch + // rather than a bare flame - the stick mesh, ItemDrop, durability, all of it - + // goes the same way. + foreach (Component comp in m_instance.GetComponentsInChildren(true)) { + if (comp is Transform || comp is ParticleSystem || comp is ParticleSystemRenderer || comp is Light) continue; Object.Destroy(comp); } - foreach (Collider col in m_instance.GetComponentsInChildren(true)) - { - Object.Destroy(col); - } return true; }