Good afternoon!

I have a skeleton in Spine with transformations applied to its scale, and in Unity, I instantiate objects (weapons) in its right hand. However, I would like these weapons to not inherit the scale changes. What is the correct way to achieve this? Right now, if the size of the hand grows (due to transform constraints that modify the skeleton to adapt to different proportions), the weapon also scales up, but it should always remain the same size.

The weapon is a simple object with a sprite renderer and not much else.

Thank you very much for your help!

    Related Discussions
    ...

    Good afternoon!

    To ensure that the weapons do not inherit the scale changes from the skeleton, you can use the BoneFollower component in Unity. This component allows you to attach GameObjects to specific bones in the skeleton without inheriting the scale transformations. Here’s how you can achieve this:

    1. Add a BoneFollower Component: Attach a BoneFollower component to the weapon GameObject.
    2. Set the Target Bone: In the BoneFollower component, set the target bone to the right hand bone of your skeleton.
    3. Disable Inherit Scale: Ensure that the BoneFollower component has the Follow Local Scale option disabled. This will prevent the weapon from scaling with the hand bone.

    Here is a step-by-step guide:

    1. Add the BoneFollower Component:

      • Select your weapon GameObject in the Unity hierarchy.
      • Click on Add Component and search for BoneFollower.
      • Add the BoneFollower component to the weapon GameObject.
    2. Configure the BoneFollower Component:

      • In the BoneFollower component, set the SkeletonRenderer to the skeleton GameObject.
      • Set the Bone Name to the name of the right hand bone in your skeleton.
      • Ensure that the Follow Bone option is enabled.
    3. Disable Inherit Scale:

      • In the BoneFollower component, uncheck the Follow Local Scale option.

    This setup will ensure that the weapon follows the right hand bone's position and rotation but does not inherit its scale, keeping the weapon size consistent regardless of the hand's scale transformations.

    For more detailed information, you can refer to the BoneFollower documentation.

    I hope this helps! Let me know if you have any further questions.

    Hello, Bot (and everyone else hehe)

    I tried this but there should be something I'm missing. As you can see in the following screenshot, both skeletons are using the same weapon (and are the same skeleton with transform constrains). As the skeleton is in some bones scaled down in the right character, the weapon is downscaled too:

    Also, the weapon prefab needs a skeleton and bone reference, but I tried with many bones from the structure and nothing changes (related to size).

    The bone structure is as follows:

    And the scale transform is applyed in the R-handpalm bone, in both skeletons, while the weapon are instanciated in the R-Weaponholder bone position.

    Could you give me some advice about how to proceed?

    Thank you very much!

    PS: To clarify, I just need the weapon to keep its size, while following position and transform no matter the skeleton using it.

    Yimec Right now, if the size of the hand grows (due to transform constraints that modify the skeleton to adapt to different proportions), the weapon also scales up, but it should always remain the same size.

    I'm not sure I understand the situation completely. Do you mean that you want to use e.g. the initial scale of a hand bone, but no longer adjust to scale changes that may follow later? If so, the clean solution would be to have a separate weapon bone at the same level as the hand instead of sharing the hand bone scale. This weapon bone could then always scale the weapon independently of your hand.

    Hello @Harald !

    What happens is that, being a child of a hierarchy of objects (bones) that have their scale modified at some points in the hierarchy, the weapon’s final scale is affected (not by itself, but by its parent objects).

    I’m not sure if I fully understood how to use the BoneFollower, but I discovered that I can achieve this behavior, as if it were a child of a specific bone, without actually being part of that hierarchy. That is, the weapon is now a "free" object, but it inherits the position and rotation just as if it were "contained" within the R-WeaponHolder bone.

    I’m not sure if this is the correct way to use this component, but for now, it seems to be working. However, if there is any mistake in this approach, I’d appreciate it if you could point it out so I can learn to use it properly.

    Thank you very much for your time and patience!!

      Yimec I’m not sure if I fully understood how to use the BoneFollower, but I discovered that I can achieve this behavior, as if it were a child of a specific bone, without actually being part of that hierarchy. That is, the weapon is now a "free" object, but it inherits the position and rotation just as if it were "contained" within the R-WeaponHolder bone.

      Glad to hear you've figured it out. Yes, the purpose of BoneFollower is to let a separate GameObject follow the position, rotation and/or scale of a target bone of a skeleton.