• Editor
  • How to move a bone independently of other bones in animation?

I have a simple character skeleton (human).
The character skeleton has bones - torso, arms, legs. The simplest skeleton.

The weapon bone is attached to the character's wrist. A cell with a weapon is placed in this bone.
This is how the character holds the weapon.

When the character raises his hand, the shoulder bone affects the forearm bone, which affects the wrist bone, which affects the weapon bone (connected bones). The character raises his hand with the weapon.

When the character dies, he falls. The fall animation changes the position of the skeleton, bones, the character can rotate his arms, etc.

But the weapon must fall out of the character's hand and fall separately from him (he unclenched his wrist
and dropped the weapon). But the bones are connected. Which makes it impossible for the weapon to fall separately. Otherwise, you will have to set each frame for the weapon bone, which is absurd.

In almost any death animation, the weapon falls out of the hands.
How can this problem be solved?

PS
It would be great if in animation it was possible to reassign the hierarchy of bones or set a bone parameter - not to depend on the parent bone.

Related Discussions
...

To achieve the effect of a weapon falling out of a character's hand independently of the character's bones, you can use a combination of techniques in Spine and Unity. One approach is to detach the weapon from the character's skeleton at runtime. You can do this by disabling the weapon attachment in the skeleton and enabling a separate GameObject that represents the weapon. This GameObject can be positioned at the weapon bone's location using a BoneFollower component before detaching it. Once detached, you can apply physics or animations to the weapon GameObject to simulate it falling separately from the character. This method allows the weapon to move independently without needing to keyframe each frame manually.

@EIvanov Sorry that Spinebot is assuming you're using Unity for some reason while you haven't mentioned which runtime you're using. If you're in fact using spine-unity, it would indeed likely be the easiest way to use a separate GameObject and a BoneFollower to attach the weapon to the target bone and disable following once it should be disconnected and letting e.g. a Rigidbody with a BoxCollider2D let the weapon fall to the ground and interact physically with your scene accordingly. Another solution in spine-unity would be to use a SkeletonUtilityBone to override the bone location once it should be falling to the ground. You can check out the example scene Spine Examples/Other Examples/SkeletonUtility Animated Physics for SkeletonUtilityBones in mode override.

If for some reason you don't want to solve this on the runtime side and want to cover it in the Spine Editor, one solution would be to use a transform constraint to let the weapon follow your wrist bone and not be a child of the wrist, and when it should fall down set the constraint's Mix value to 0.

    4 أيام لاحقا

    Harald Thanks for the reply. Yes I am working with unity. The animation is quite simple and it is desirable to make the weapon drop in the editor. Doing physics in unity is still difficult for me. Also I haven't tried working with transform constraint yet.
    -----
    A little offtopic as an experiment.
    I realize that this is not very normal, but still, I made the weapon drop frame by frame (for the first time, as a test).

    I set it to 60 frames per minute.
    My animation lasts 120 frames - 2 seconds.
    For the first 60 frames I changed the position of the bone with the weapon - moved it down (not every frame).
    The last 60 frames, the weapon was supposed to be on the ground.
    The last 60 frames, every frame, I changed the absolute position of the bone, for example setting it x=-232.0 y=95 (the weapon is down and lying on the ground).

    Interestingly, when setting x=-232.0 y=95 every frame, the weapon “twitches” from frame 30 to 44, along the x-axis, when the animation plays. But this should not be!
    There are keys on all frames. And all keys are the same.

    And if you slowly move the pointer through the frames, there will be no twitching. Perhaps it's a spine bug.

    Do I understand correctly that this method is incorrect but does not affect performance? Spine does not care how many frames in the animation and whether there are keys in each frame or only in the first and last?

      EIvanov Did you simulate the weapon being reparented using a transofrm constraint as suggested by Harry above?
      https://esotericsoftware.com/spine-transform-constraints/

      Regarding your performance question, more keys will make your animation heavier.
      As per our user guide:

      Having fewer keys makes it easier to work on an animation and reduces the size of the exported animation data, especially when deform keys are removed. Also, fewer keys makes applying the animation at runtime use slightly less CPU.

      https://esotericsoftware.com/spine-keys#Clean-Up
      https://esotericsoftware.com/spine-metrics