To have your instanced GameObjects (weapons) follow a specific bone's position, rotation, and scale in Spine, you should use the BoneFollower
component rather than SkeletonRootMotion
. SkeletonRootMotion
is used for a different purpose, mainly to apply root motion from animations to move your character in Unity, which doesn't seem to be what you're looking for.
Based on the information you've provided, here's how you can proceed:
Attach the BoneFollower
component to your weapon GameObjects in Unity. This component is designed to make the GameObject follow a specific bone from your Spine skeleton.
Configure the BoneFollower
component by setting the SkeletonRenderer
to the renderer of your character's skeleton and specifying the name of the bone that the weapon should follow. This bone would be the specific position you mentioned that you created in Spine for this purpose.
Ensure the weapon GameObjects are instanced as children of the GameObject that contains the Spine character (or at least in a way that they can correctly reference the SkeletonRenderer
of your character). This setup allows the BoneFollower
to correctly update the weapon's transform based on the bone's current transform each frame.
This approach will ensure that your instanced weapons correctly follow the designated bone's position, rotation, and scale, allowing for dynamic weapon switching and positioning based on your character's animations.
For more detailed information on setting up and using the BoneFollower
component, you can refer to the Spine-Unity documentation and examples provided by Esoteric Software.