我有两个骨架,一个是角色的,另一个是充满物理约束的配件,现在我想把配件的骨架挂载到角色预留的某块骨骼上,看配件跟随角色动画时候的效果,但是我把配件的骨骼拖到角色身上时,配件上的约束都取消了,我该如何在保持配件骨架自带约束的同时,把他转移到另一个骨架里呢
如何在保持约束的状态下将一个骨架挂载到另一个骨架上?
要在保持约束的状态下将一个骨架挂载到另一个骨架上,可以使用 BoneFollower
组件(如果你使用的是Spine的Unity运行时)。这允许一个GameObject跟踪特定骨骼的位置,然后你可以将配件骨架的GameObject设置为这个 BoneFollower
对象的子对象。这样,配件骨架就可以保持其内部约束的同时,跟随另一个骨架的指定骨骼移动。
如果你不是在Unity环境中工作,那么你需要根据你所使用的运行时环境寻找类似 BoneFollower
的解决方案。基本思路是获取目标骨骼的世界位置,并让配件骨架或其根骨骼在每一帧中更新到这个位置。这样做可以保持配件骨架的约束不变,同时使其能够跟随另一个骨架的动作。
foxrever Unfortunately, the current functionality does not allow you to keep the constraint settings when moving bones from one skeleton to another. We are already aware of this problem and mention it in one of our issue tickets : EsotericSoftware/spine-editor582
However, since Spine 4.2, it is now possible to copy and paste the constraint settings, making it much easier to reconfigure the constraint. (Copying and pasting settings works well for different skeletons as well.)
In the tree view, select the name of the constraint whose settings you want to copy and press Ctrl+C
. Then select the name of the constraint you want to paste and press Ctrl+V
.