- Modificato
Setting Bone Positions During Runtime
Hello,
I'm making a game in which you can build your own monster.
The sprites are presented to the player and the player chooses where to put the arms, legs, etc.
How can I set the bones positions (say, if an arm has 3 or 4 bones in it) in unity during runtime so the animations made in Spine will work?
Thank you so much, Ori.
You can get a bone with Skeleton findBone
and set Bone x
and Bone y
. Keep in mind these are local positions. See Bone worldToLocal
to transform a world position to a local position. More info here:
Runtime Skeletons - Spine Runtimes Guide
The spine-unity runtime provides a SkeletonUtilityBone
component to override bone position while configurable to e.g. keeping rotation intact. Please see the documentation sections on how to setup and use.