• Editor
  • How to destroy a character?

Usually there are no problems with animations.
We are talking about death animation (character destruction).
But the character is a skeleton (by skeleton we mean an enemy, a monster).

The skeleton consists of bones and when it attacks, upon death, the bones should fly apart independently of each other.

But this is extremely difficult to do because In the animator, it is impossible to reassign bones, for example, attach them all to the root one, to animate the destruction of the skeleton.

When dragging bones in an animation, you can disable the influence of parent bones on drawing bones. This will work when the bone is displaced, but not when rotated.

What can you do here?
Animating the destruction of the skeleton frame by frame - exposing each bone is incredible work.

Duplicating the skeleton and somehow reconnecting it in the code = breaking the architecture of the script, which only works with 1 skeleton.

Related Discussions
...

To achieve the effect of a skeleton's bones flying apart upon death, you can use a combination of techniques to simplify the process and avoid breaking your existing architecture. Here are some steps you can follow:

  1. Use Compensation Tools: Utilize the compensation tools in Spine to move parent bones without affecting the children. This can help you set up the initial positions for the bones before they fly apart. You can read more about compensation tools here.

  2. Manual Bone Manipulation: You can stop updating the skeleton and manually apply transforms to the bones. This allows you to control the position and rotation of each bone independently. Here is a pseudocode example:

        time += Gdx.graphics.getDeltaTime();
        if (!explode) {
            animationName.apply(skeleton, time, time, true, null);
        } else {
            skeleton.findBone("bonename").setPosition(...);
            // Set positions for other bones as needed
        }
  3. SkeletonUtility Ragdoll: In Unity, you can use the SkeletonUtility Ragdoll component to create a ragdoll effect. This component allows bones to be influenced by physics, which can simulate the bones flying apart. You can find an example in the Spine Examples/Other Examples/SkeletonUtility Ragdoll scene.

  4. Separate Skeletons: If the above methods are not sufficient, consider creating a separate skeleton for the death animation. This skeleton can be set up specifically for the destruction effect, with bones already detached and ready to animate independently. You can switch to this skeleton upon the character's death.

  5. Root Motion: For more complex movements, you can use root motion to control the entire skeleton's movement. This technique allows the animation to define the movement, which can be useful for creating a more dynamic destruction effect.

By combining these techniques, you can achieve the desired effect of bones flying apart without having to manually animate each frame or break your existing script architecture.

It's often done at runtime, like the ragdoll script mentioned. This can give you dynamic movement.

In 4.2 you can key bone inheritance, so you could disable it for the bones you want to fly off.

For some simple scenarios it can be done using transform constraints to simulate reparenting. This is useful any time you want to simulate reparenting, not just for ragdoll.

Another simple solution is to fake it by having the same attachment on a different bone. Done carefully, visually it looks the same, but the bones are different and so can be animated to explode/etc more easily. You could use skin bones so the exploding bones don't cost anything when the skeleton is not exploding.