我的骨骼结构如下
root(其世界位置为<0,0>)
----boneA(其本地位置为<0,0>)
----boneB(其本地位置为<100,0>)

让我感到困惑的是下图红框中的这个信息

当我手动移动boneB的时候,该坐标信息会进行更新,以正确的显示相对于父级的本地坐标

而当我创建一个变换约束的时候,将移动的X和Y的混合都设置为100,此时boneB的位置被约束至和boneA的位置一致,在我的理解中boneB此时因为这个变换约束,保持和boneA的位置一致,也就是<0,0>位置,那么其相对父级root骨骼的本地坐标应该更新为<0,0>,但是这个面板上的坐标信息确仍然是<100,0>

针对以上情况,请问这是一个bug吗,还是这个面板有特定的显示规则,比如受约束的骨骼的坐标信息将不进行更新?

我对坐标信息预期的显示逻辑和游戏引擎中一致,每个节点都会实时显示当前的坐标信息,所以Spine的这个面板信息让我有点困惑,希望能得到解答,如果Spine的坐标信息显示规则有所不同,请问我能在哪里学习这个规则?

    Related Discussions
    ...

    ECG_Kinsey Sorry for the late reply! The behavior you are seeing is as expected. Perhaps the best guide to understand this is the general Spine Runtimes Guide. There you will find an explanation of the order in which the coordinates of the bones are calculated:
    https://esotericsoftware.com/spine-runtime-skeletons

    Basically, using constraints does not directly override the local transformation information, but combines it with the mix value set by the constraint to calculate the bone's world transform. Unless you click the dot next to the constraint's name in the tree view to exclude it, what you see in the viewport is based on the world coordinates after the constraint is applied, but the local coordinates are preserved, so as you say, the world coordinates and the position of the local coordinates may not match.

      Misaki 我明白了,感谢您的指导

      Misaki 我理解骨骼的本地坐标和世界坐标的计算方式,以及变换约束的应用计算方式。在变换约束基于目标骨骼的原始世界坐标和约束混合比例进行计算之后得到了该骨骼的新的世界坐标,这个新的世界坐标会在目标骨骼坐标信息面板上进行更新显示,同时目标骨骼的新世界坐标相对于其父骨骼有了新的本地变换(在父骨骼没有变换的前提下),但是这个新的本地变换并没有显示在面板上,面板上该骨骼的本地变换信息停留在了应用变换约束之前。

      我之前一直以为这个面板上的信息是实时更新的,无论这个当前的信息是基于变换约束计算出来的,或者是其他约束,这个面板上的信息永远反映了对应骨骼当前的信息,如世界坐标,相对于父骨骼的本地变换信息等等,因为这样似乎更容易让使用者得到理解(所见即所得),游戏引擎如Unity的变换信息也是这样的显示规则,而且从技术上而言,这个也是容易实现的。

      所以我想知道的是,是否Spine目前这样做(指应用变换约束之后,骨骼的本地变换信息不实时更新),有什么特殊的用意

        ECG_Kinsey Perhaps it is easier to understand why it is displayed as you see it now if you consider the case where the constraint mix is animated. Below is an example of moving boneB by changing the Mix of the Transform constraint: when the World axis is selected, the X coordinate of boneB changes, but when the Local axis is selected, the X coordinate of boneB does not change. This makes a lot of sense given the state of the keys on the dopesheet. It is not boneB that is animated, but the transform constraint:

        If the local translate X/Y value of the bone changes, I think the user would expect the animation to have some translate keys. I think it is desirable that the Local value does not change to clarify what is animating this bone.
        If my explanation is off from what you want to know, please feel free to let me know.

          Misaki 骨骼在受约束的情况下,本地坐标不实时更新,这有助于在动画状态下区分骨骼移动的动画表现是平移的关键帧导致的还是约束的关键帧导致的

          我理解了上述理念,这确实有一定帮助。但是如果基于上述理念,那么是否骨骼在受约束的情况下,世界坐标也不应该实时更新,用户看到动画状态下骨骼的世界坐标有更新也可能会误以为摄影表中存在该骨骼平移相关的关键帧,为什么世界坐标的处理方式和本地坐标不同,如果基于上面这个设计理念,我可能会预期世界坐标和本地坐标的逻辑一致,在受约束的情况下都不更新。

          It's a part of Spine that no one has asked about before. I like that you are curious about how it works! 🤓

          When constraints modify the local transform, the result is what we call the "applied local transform" or just "applied transform" for short (it's always local).

          When constraints modify the world transform, a new applied transform is computed backward from the world transform. This way a bone always has an applied transform.

          The local transform has no constraints applied. The applied transform is the local transform that one or more constraints have modified. If no constraints have been applied then there is still an applied transform, it's just identical to the local transform.

          A bone's world transform is computed using its applied transform and all its parent applied transforms.

          The reason we separate the local transform from the applied transform is so the changes constraints make don't permanently modify the local transform. We'll need that local transform again later (like the next game frame render) to apply constraints again.

          So, those are the pieces involved. Next is about what numbers Spine currently displays in the main toolbar. It shows:

          • The local transform: no constraints applied.
          • The parent transform: the local transform converted to parent coordinates (where it makes sense), so no constraints applied.
          • The world transform: constraints applied and converted to world coordinates.

          The local transform is shown because that is what is keyed, as Misaki mentioned. Even if you have it display Parent or World, when you set keys you are actually storing the local values in the keys. When you click a dopesheet key, the only way to see what values are keyed are to look at the main toolbar (or use the graph).

          The world transform is shown with constraints applied because if you note the pieces involved above, there isn't actually a world transform computed with no constraints applied. We could compute that of course, but I'm not sure when it would be useful.

          I agree it is slightly strange that world values update while parent and local values do not. I don't think it's particularly problematic though and it's based on what values are most useful for people to see.

          We don't show the applied transform at all. We could, and possibly there are cases where it would be useful, such as when correlating applied transform values with runtime values. I don't think it should be the default though, as most of the time you care about the keyed values.

            Nate 感谢您和Misaki的耐心讲解,我觉得我理解了。Spine的变换规则由于约束功能的存在,比Unity的变换规则要更复杂一些,最关键的部分是多了"applied local transform"的概念。

            我之前预期的“所见即所得”,应该是期望将"The local transform"显示为"applied local transform",但是由于变换的关键帧永远是基于"The local transform",所以确实需要将这两个概念做一下区分,避免用户产生明明没有对"The local transform"进行关键帧动画,但是"The local transform"却发生了变化的困惑。

            正如您所说,这个问题不影响我对动画的制作,我仅仅是单纯因为Spine的坐标系工具栏的显示规则和我预期的不一致而感到好奇,我觉得搞懂这个问题将有助于我Spine掌握的更好。

            另外我觉得这个"applied local transform"的显示与否,能否作为Spine设置中的一个选项来进行开启,比如调试模式,在该模式下,"applied local transform"只能显示,但是不能被用户手动修改。因为我觉得这能帮助某些用户在使用约束的时候更好的理解约束的工作原理,用户可以清清楚楚的看到约束是怎么对骨骼的坐标产生影响的。

            以及我想知道是否有文档专门说明了这个"The local transform"和"applied local transform"的概念差异,因为部分游戏引擎的用户,可能会将骨骼的"The local transform"概念理解为:骨骼当前世界坐标通过矩阵变换到其父骨骼坐标系下的相对坐标。所以会预期"The local transform"是会实时变换的。如果有文档的话,可能会帮助部分用户更好的理解Spine的工作方式。

            Cool, I'm glad it made sense! It's a bit tricky and dives into the deeper parts of Spine, where few others go. 🤿

            We'll consider a way to see the applied transform on the main toolbar.

            The applied transform is only described here in the API reference:
            http://esotericsoftware.com/spine-api-reference#Bone-updateAppliedTransform
            It is mostly only a concept that users are exposed to at runtime, where developers have access to both the local transform (x, y, scaleX, etc) and the applied transform (ax, ay, ascaleX, etc).