• 中文
  • 骨骼的scale为负数时,在unity上不可见

您好,我做翅膀的挥动的动画,需要用到将翅膀的骨骼的scale变为负数。
在spine软件上可以得到很好的效果,但是导入unity后,当播放到翅膀的骨骼变为负数时,翅膀就看不到了。

Related Discussions
...
  • تم التحرير

对不起,我们感到抱歉!
We are sorry for the trouble!

您能否告诉我们您使用的Spine和spine-unity运行时版本(unitypackage的名称)? 我们过去已经修复了一个相关的bug。
Could you please let us know which version of Spine and spine-unity runtime (name of the unitypackage) you are using? We have fixed a related bug in the past.

Harald wrote

对不起,我们感到抱歉!
We are sorry for the trouble!

您能否告诉我们您使用的Spine和spine-unity运行时版本(unitypackage的名称)? 我们过去已经修复了一个相关的bug。
Could you please let us know which version of Spine and spine-unity runtime (name of the unitypackage) you are using? We have fixed a related bug in the past.

thank you for the reply.
the version I am using is spine-unity-3.8-2019-08-0

那么bugfix应该已经包含在你的unitypackage中了。
Then the bugfix should already be included in your unitypackage.

您是否可以在Spine项目中使用设置为“World”而不是“Local”的约束?以下是对类似问题的解释:
[runtimes] Scale of -1 results in incorrect bone orientation · #1373
Are you maybe using constraints in your Spine project that are set to World instead of Local? Here is an explanation at a similar issue:
[runtimes] Scale of -1 results in incorrect bone orientation · #1373

翻译:

对于狗项目,头发控制顶部是约束头部顶部TCS的目标骨骼,其设置为世界(未选中本地),相对和旋转混合100%。这意味着在约束骨骼的旋转将是他们的无约束旋转加上目标骨骼的世界旋转。

当骨架scaleX为1时,目标骨骼世界旋转为6.29。受约束的骨骼被调整为它们的局部旋转+ 6.29。

当骨架scaleX为-1时,世界旋转为173.71(== 180 + 6.29)。受约束的骨骼被调整为它们的局部旋转+ 173.71。这将它们指向您想要的方向180度。

这正如设计的那样正常工作。世界旋转(由约束使用,由Bone getWorldRotationX返回等)受骨架尺度的影响。

狗项目最简单的修复方法是通过选中Local来更改约束以使用目标骨骼的局部旋转,而不是世界旋转。修复它的另一种方法是使用绝对世界旋转,通过取消选中相对,这是有效的,因为受约束的骨骼旋转设置为匹配目标骨骼而不是添加到目标骨骼。在绝对世界旋转时,受约束的骨骼将指向相同的方向,因此网格可能需要以不同方式绑定到骨骼。

Original Text:

For the dog project, the Hairs Control Top is the target bone of the constraint Hairs Top TCS, which is set to World (Local is not checked), Relative, and Rotate mix 100%. This means at the constrained bones' rotation will be their unconstrained rotation plus the world rotation of the target bone.

When the skeleton scaleX is 1, the target bone world rotation is 6.29. The constrained bones are adjusted to be their local rotation + 6.29.

When the skeleton scaleX is -1, the world rotation is 173.71 (== 180 + 6.29). The constrained bones are adjusted to be their local rotation + 173.71. This points them 180 degrees from the direction you want.

This is working correctly, as designed. The world rotation (used by constraints, returned by Bone getWorldRotationX, etc) is affected by the skeleton's scale.

The easiest fix for the dog project is to change the constraint to use the target bone's local rotation, not the world rotation, by checking Local. Another way to fix it would be to use the absolute world rotation, by unchecking Relative, which works because the constrained bones' rotation is set to match the target bone rather than added to it. With the absolute world rotation the constrained bones will all point the same direction, so the mesh may need to be bound to the bones differently.

Harald wrote

那么bugfix应该已经包含在你的unitypackage中了。
Then the bugfix should already be included in your unitypackage.

您是否可以在Spine项目中使用设置为“World”而不是“Local”的约束?以下是对类似问题的解释:
[runtimes] Scale of -1 results in incorrect bone orientation · #1373
Are you maybe using constraints in your Spine project that are set to World instead of Local? Here is an explanation at a similar issue:
[runtimes] Scale of -1 results in incorrect bone orientation · #1373

翻译:

对于狗项目,头发控制顶部是约束头部顶部TCS的目标骨骼,其设置为世界(未选中本地),相对和旋转混合100%。这意味着在约束骨骼的旋转将是他们的无约束旋转加上目标骨骼的世界旋转。

当骨架scaleX为1时,目标骨骼世界旋转为6.29。受约束的骨骼被调整为它们的局部旋转+ 6.29。

当骨架scaleX为-1时,世界旋转为173.71(== 180 + 6.29)。受约束的骨骼被调整为它们的局部旋转+ 173.71。这将它们指向您想要的方向180度。

这正如设计的那样正常工作。世界旋转(由约束使用,由Bone getWorldRotationX返回等)受骨架尺度的影响。

狗项目最简单的修复方法是通过选中Local来更改约束以使用目标骨骼的局部旋转,而不是世界旋转。修复它的另一种方法是使用绝对世界旋转,通过取消选中相对,这是有效的,因为受约束的骨骼旋转设置为匹配目标骨骼而不是添加到目标骨骼。在绝对世界旋转时,受约束的骨骼将指向相同的方向,因此网格可能需要以不同方式绑定到骨骼。

Original Text:

For the dog project, the Hairs Control Top is the target bone of the constraint Hairs Top TCS, which is set to World (Local is not checked), Relative, and Rotate mix 100%. This means at the constrained bones' rotation will be their unconstrained rotation plus the world rotation of the target bone.

When the skeleton scaleX is 1, the target bone world rotation is 6.29. The constrained bones are adjusted to be their local rotation + 6.29.

When the skeleton scaleX is -1, the world rotation is 173.71 (== 180 + 6.29). The constrained bones are adjusted to be their local rotation + 173.71. This points them 180 degrees from the direction you want.

This is working correctly, as designed. The world rotation (used by constraints, returned by Bone getWorldRotationX, etc) is affected by the skeleton's scale.

The easiest fix for the dog project is to change the constraint to use the target bone's local rotation, not the world rotation, by checking Local. Another way to fix it would be to use the absolute world rotation, by unchecking Relative, which works because the constrained bones' rotation is set to match the target bone rather than added to it. With the absolute world rotation the constrained bones will all point the same direction, so the mesh may need to be bound to the bones differently.

No, I didn't use any constraints.
I just made an animation scaling the bone of the wing from 1 to -0.5;
It works well in Spine itself.
But the wing disappear when the bone reaches negative value.
That's annoying.

Which shader are you using?

If you are using any of the Spine shaders: You can send us a minimal Unity project that still shows the problem as a zip file, to contact@esotericsoftware.com. Then we can have a look at it.

If you are using a non-Spine shader, it will most likely be due to backface culling. Then you would need to switch to a different shader or disable culling on the shader.