• Unity
  • How to sync animation of 2 skeletons.

In our project, we have a skeleton for each character and a skeleton for each weapon they hold. The animation set on the weapon matches the characters animation set:

Idle, Walk, Attack1, Attack2, etc

. Is there an easy way to have the weapon skeleton always match the animation state of the character skeleton?

Related Discussions
...
  • Изменено

I'm afraid there is no direct way like reusing a single AnimationState for different skeletons, since the TrackEntry would need to reference a completely different Animation object (which just happens to have the same name).

Nevertheless, if you issue the same AnimationState calls (like SetAnimation, AddAnimation or modifying TrackEntry) on each of the skeletons, both skeletons will be in sync automatically. Programming-wise this should be achievable rather easily via a single layer of indirection that sets your animations on multiple instead of a single skeleton.