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; }