• RuntimesUnity
  • Instancing gameobjects and follow a bone position

Hello everyone!

I'm working on a different project now, where player can set up their character appearance (mixing skins, so far, but I will come back later to ask how to manage hundreds of skins attachments for character customization).

The issue now is this player can have many weapons from a database that will use randomly, these are gameobjects that are instanced in an specific position (a bone created for this in spine).
What is happening is the weapon is instancing, but not inherits the transform (position, rotation and so).

I've been reading the documentation but I don't understand the SkeletonRootMotion which I think is what I need to use, so if anyone could explain how to proceed with this it would be awesome!

Thank you very much, I hope I've made clear myself, if not let me know to attach more information of the problem.

Have a nice day!

Related Discussions
...

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:

  1. 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.

  2. 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.

  3. 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.