• 中文
  • 请问怎么同步动画? (spine-unity)

我使用了一样的骨骼动画对象, 作为影子. 我想让他们的动作完全一致, 请问有什么好办法吗? 🙂

我想说的是,从你的问题中我无法判断你是想在编辑器上还是在运行时创建阴影,所以你能不能再详细说明一下你想达到的效果?

I'm afraid to say but from your question I couldn't tell whether you wanted to create the shadow on the editor or at runtime, so could you please elaborate a bit more on the effect you want to achieve?

Misaki wrote


这是官方的例子. 我想使用这个方式制作影子. 我想让影子的骨骼动画和Player的骨骼动画保持一致. 请问有什么简单的方式实现?

7일 후

是很好! 但“RenderExistingMesh”和“SkeletonRenderTexture”组件不能一起使用。


That's good! But the "RenderExistingMesh" and "SkeletonRenderTexture" components cannot be used together.

您的意思是您正在使用“SkeletonRenderTexture”示例组件正常渲染“SkeletonAnimation”游戏对象,然后想使用例如第二次绘制它。 灰色覆盖层来渲染阴影?

如果是这样,那么您可以创建 SkeletonRenderTexture 示例脚本的副本并对其进行修改,以便它创建两个游戏对象而不是仅一个来渲染 RenderTexture,然后只需在以下位置分配相同的 MeshRenderTexture 两者都创建了游戏对象,并在新的阴影游戏对象上使用灰色叠加着色器。

或者,您可以创建一个类似于相当简单的“RenderExistingMesh”示例脚本的 scipt,您将主要需要调用类似“ownMeshFilter.sharedMesh = referenceMeshFilter.sharedMesh;”的内容来为每个帧分配另一个“MeshFilter”的网格。 然后你还需要在你自己的 MeshRenderer 中分配其他 MeshRenderermaterial.Texture。 基本上这应该是所有必要的。


Do you mean that you are using the SkeletonRenderTexture example component to render the SkeletonAnimation GameObject normally, and then want to draw it a second time using e.g. a gray overlay to render a shadow?

If so, then you could either create a copy of the SkeletonRenderTexture example script and modify it so that it creates two GameObjects instead of only one to render the RenderTexture, then simply assign the same Mesh and RenderTexture at both created GameObjects, and use a gray color overlay shader at the new shadow GameObject.

Alternatively, you could create a scipt similar to the rather simple RenderExistingMesh example script, you will mostly need to call something like ownMeshFilter.sharedMesh = referenceMeshFilter.sharedMesh; to assign the mesh of the other MeshFilter every frame. Then you also need to assign the material.Texture of the other MeshRenderer at your own MeshRenderer. That should be all that's necessary basically.