我有一个角色,它的皮肤A拥有骨骼Bone1,骨骼Bone1下面是插槽Slot1,插槽拥有附件BoundingBox1,。
该角色还有另一个皮肤B,而皮肤B不具备骨骼Bone1

我的BoundingBoxFollower组件将属性SlotName设置为Slot1,而在角色用皮肤A展示的时候BoundingBoxFollower组件运行正常,而当我将角色从皮肤A切换到皮肤B的时候,BoundingBoxFollower仍然将皮肤A中的BoundingBox1这个附件的碰撞盒激活了。

我认为角色在皮肤B的情况下没有对应的插槽,也没有对应的附件,此时BoundingBoxFollower应该将该附件对应的碰撞盒隐藏,而现在的情况和我预期的不同,请问是bug还是我哪里没有设置正确

    Related Discussions
    ...

    ECG_Kinsey Sorry for the trouble. Could you please send us a minimal project that can confirm the problem via email?: contact@esotericsoftware.com
    Please include the URL of this forum thread in the email so we know the context. Then we can take a look at what's wrong.

      Misaki 已经将邮件发至对应邮箱

      其中A皮肤的动画中BoundingBox会在特定时间内激活显示,而B皮肤则没有BoundingBox对应的骨骼和关键帧,B皮肤在Spine中播放动画的时候不会激活该BoundingBox

      Unity的工程中有两个按钮用于切换皮肤A和B,可以看到皮肤A的BoundingBox表现与Spine中一致,而切换到皮肤B的时候,BoundingBox异常显示

        ECG_Kinsey Thank you for sending both the Unity project and Spine project files! This is not a runtime issue, but rather an issue with the skeleton skin settings.

        Your skeleton had the Weapon bone included in Skin A, but the Bounding Box attachment was not included in the same skin. (A skin placeholder for including it in the skin had not been created.)
        Using skin bones to hide attachments below them in this way can lead to incorrect results, as in this case. If you want a specific attachment to be available only when a specific skin is applied, place it below the skin placeholder.

          Misaki 这个问题在添加皮肤占位符之后得到了解决。

          在此之前我的解决方式为:在BoundingBoxFollower脚本生效前额外判断其所依赖的骨骼是否为Active状态,从而来决定是否启用BoundingBoxFollower脚本,也能达到一样的效果。

          按照目前您所提供的方式去设置骨架和皮肤,在我拥有多个角色时(通过皮肤的方式来创建角色),这样会导致维护他们的武器碰撞盒的附件成为一个额外的工作成本,尽管这些角色所持的武器一样,碰撞盒也完全一样,使用该武器进行攻击的动画也一样。

          我有一个疑问,为什么用户通过皮肤隐藏骨头的形式从而隐藏其下方附件的形式不能作为一个官方建议的做法去实施呢,这样子就可以避免我上面提及的这个情况所导致的工作成本,对于用户工作效率而言是更好的。此外这个皮肤不包含的骨骼,自然不包含骨骼下面的附件,其下面的附件自然也不生效,我想大部分用户应该会这样认为,也符合所视即所得的理念,对于用户的体验而言也是更好的。

          目前Spine没有这样去支持这个功能,是出于什么原因呢,后续是否会打算做这方面的支持呢?

          @ECG_Kinsey Please note that usually it's not a good idea to use moving tight colliders around swords for hit detection. See this forum posting regarding hit boxes in Street Fighter:
          https://esotericsoftware.com/forum/d/14667-spine-libgdx-collision-detection/3

          Regarding your questions in the last posting, unfortunately machine translation was quite unclear. Do you mean that the spine-unity components are not automatically disabled or updated when the skin-bone is disabled or something like that? If so, could you please describe what exactly are you expecting, and what you get instead?

            Harald
            我无法打开你帖子中的链接

            我已将能重现这个问题的邮件发至contact@esotericsoftware.com,邮件名为【BoundingBoxFollower组件运行疑似有bug】

            您可以结合该邮件中的工程来理解我所说的问题

            这里有两个皮肤A和B,这两个皮肤不一样的地方是,皮肤A中包含了名为Weapon的皮肤骨骼

            这个weapon骨骼中拥有一个BoundingBox附件

            以上就是项目的基础情况,您已经了解了

            同一个动画,在切换为皮肤A进行播放的时候,Spine编辑器中能看到动画中BoundingBox正常显示,切换到皮肤B的时候,Spine编辑器中能看到动画中BoundingBox未显示。

            但是在Unity中,该动画播放的时候,切换到皮肤A,BoundingBox正常显示,而切换到皮肤B的时候,BoundingBox也显示出来了(这是不对的)

            我所预期的是Spine-Unity运行时能提供Unity和Spine中一致的行为逻辑,也就是皮肤A动画过程中显示BoundingBox,而皮肤B的动画过程中不显示BoundingBox。但是目前邮件中提供的项目其BoundingBox的表现在Unity和Spine中并不一致。

            Misaki提供了解决方案,通过为BoundingBox附件添加皮肤占位符的方式,这确实能解决这个问题,但是当我拥有多个角色皮肤时,维护他们的武器的BoundingBox附件将成为一个额外的工作量,哪怕它们的武器是完全一致的,BoundingBox附件也是完全一致的。

            所以,我认为如果能够通过皮肤骨骼的方式来管理角色的武器是更加方便的,如果某个皮肤需要包含该武器,则将武器骨骼添加为该皮肤的骨骼,而因为该BoundingBox固定为该武器骨骼的附件,所以BoundingBox和该武器一一对应,我就无需再做额外的BoundingBox附件的维护。

            无论针对此类情况Spine项目的推荐做法是哪一种,我认为保持用户在Spine中看到的和在Unity中得到的一致是最佳的,因为这将减少很多潜在规则,增加Spine的易用性

              ECG_Kinsey 我无法打开你帖子中的链接

              This is strange, it's a normal forum thread URL. Could you try this link again:
              https://esotericsoftware.com/forum/d/14667-spine-libgdx-collision-detection
              If it still does not display, you could use the forum search and enter "Spine - libGDX collision detection" there and then visit the first returned search result.

              ECG_Kinsey 但是在Unity中,该动画播放的时候,切换到皮肤A,BoundingBox正常显示,而切换到皮肤B的时候,BoundingBox也显示出来了(这是不对的)

              Thanks very much for the clarification, I now understand the problem. This scenario should indeed be covered by the BoundingBoxFollower component, we will get back to you as soon as we have a fix available.

                @ECG_Kinsey For some reason we did not receive your email (also not in the spam folder). Nevertheless we have just pushed a bugfix for this issue to the 4.2 branch.

                A new spine-unity 4.2 unitypackage has been released:
                https://esotericsoftware.com/spine-unity-download
                Please let us know if this fixes your issue as well.

                Issue ticket URL for later reference:
                EsotericSoftware/spine-runtimes2836

                  Harald 在使用了最新的Spine-unity 4.2 运行时之后,这个问题得到了解决

                    Harald 我阅读了您提到的链接中的内容,对于碰撞器的使用我想这里确实存在一定的优化空间,如改为矩形的碰撞器,这将提高碰撞检测的效率并且能达到一样的运行时的效果。

                    感谢您的指导

                      ECG_Kinsey Harald 在使用了最新的Spine-unity 4.2 运行时之后,这个问题得到了解决

                      ECG_Kinsey Glad to hear it resolved your issue, thanks for letting us know.

                      ECG_Kinsey Harald 我阅读了您提到的链接中的内容,对于碰撞器的使用我想这里确实存在一定的优化空间,如改为矩形的碰撞器,这将提高碰撞检测的效率并且能达到一样的运行时的效果。

                      感谢您的指导

                      Glad it helped. Note that it's not only performance that benefits. You might also want to make the hit-boxes larger than the weapon or character limb sizes, as otherwise it may feel like a bug or unresponsive when it's too tightly bound to the actual geometry.