目前情况的,文件能够成功读取到。但是一但播放动画就会出报错

我的代码是参照官方文档的如下
<script src="https://unpkg.com/@esotericsoftware/spine-player@4.1.*/dist/iife/spine-player.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@esotericsoftware/spine-player@4.1.*/dist/spine-player.css">

<div id="player-container" style="width: 100%; height: 100vh;"></div>

<script>
new spine.SpinePlayer("player-container", {
jsonUrl: "10030_skin_Wolframite03/10030_skin_Wolframite03.skel",
atlasUrl: "10030_skin_Wolframite03/10030_skin_Wolframite03.atlas"
});
</script>
官方代码链接
https://zh.esotericsoftware.com/spine-player#Spine-Web-Player

Related Discussions
...

The error occurs when the bounds have a NaN (not a number):
EsotericSoftware/spine-runtimesblob/4.2-beta/spine-ts/spine-player/src/Player.ts#L779-L785

Skeleton getBounds is defined here:
EsotericSoftware/spine-runtimesblob/4.2-beta/spine-ts/spine-core/src/Skeleton.ts#L610
It collects the vertices for region and mesh attachments and finds the minimal and maximal vertices to determine the skeleton's bounds.

Most likely one of the mesh attachments has an invalid (NaN) vertex. The can occur if the mesh is bound to a bone that is in a skin, but the skin is not visible. Since the bone is not visible, the mesh vertices weighted to that bone cannot be computed and will be NaN. That situation will show up in the editor with a yellow warning !:
http://n4te.com/x/9547-DhNU.png
Do you have any of these warning icons in your project in the Spine editor? If so, you should fix them before exporting your skeleton data. We plan to add a "Problems" view to show the reason they appear as text, but we don't have that yet. Make sure all skin bones the mesh is bound to are in the same skin as the attachment.

  • orangestar がこの投稿に返信しました。

    Nate
    我的文件是游戏素材,正常情况应该不存在报错问题,我对spine的相关知识了解的很少。能不能帮我看看这些文件是否报错了。谢谢你回复

    10030-skin-wolframite03.zip
    3MB

    .skel is normally the file extension used for binary, but your file is JSON. You should rename it to .json, as some tools assume the file type from the extension.

    The HTML you showed uses 4.1 while your skeleton data is from 3.8. The runtime version must match the editor version used to export the data, see:
    http://zh.esotericsoftware.com/spine-versioning#%E5%90%8C%E6%AD%A5%E7%89%88%E6%9C%AC
    You can change the 4.1 version numbers in your HTML to 3.8.

    There is a spine-player for 3.8, but it doesn't have as many features as 4.1. To use 4.1 you would need to export the data again with 4.1. To do that, import your JSON into 3.8, save a .spine project file, then open that with 4.1 and export.

      Nate
      谢谢,再次感谢你的回复,我将.skel文件直接重名名后,无法读取到任何图片数据,另外,我将4.1换成3.8,发现3.8的js是不存在的。我无法获取到3.8的js,请你提供3.8的具体链接或者代码段给我。
      我无法访问3.8的js链接https://unpkg.com/@esotericsoftware/spine-player@3.8.*/dist/iife/spine-player.js

      我目前的代码
      <script src="https://unpkg.com/@esotericsoftware/spine-player@3.8.*/dist/iife/spine-player.js"></script>
      <link rel="stylesheet" href="https://unpkg.com/@esotericsoftware/spine-player@3.8.*/dist/spine-player.css">

      <div id="player-container" style="width: 100%; height: 100vh;"></div>

      <script>
      new spine.SpinePlayer("player-container", {
      jsonUrl: "10030_skin_Wolframite03/10030_skin_Wolframite03.json",
      atlasUrl: "10030_skin_Wolframite03/10030_skin_Wolframite03.atlas"
      });
      </script>

      • Charles がこの投稿に返信しました。

        orangestar Nate

        Hi Nate, the oldest version I can find on NPMJS is 4.0.1, so it's not uncommon to see 404 on UNPKG CDN. Is there any possible misunderstanding?

        And orangestar, since the HTML and data versions do not match, and HTML cannot find the 3.8.* version, why not try upgrading data to the latest? XD

        • Nate が「いいね」しました。

        Oh, sorry about that. On Monday I will ask my colleagues about the status of 3.8 on unpkg.

        You can always build the spine-player for 3.8 or any other version from source. For your convenience I did so and here are the 3.8 files:
        http://n4te.com/x/9563-spine-player-3.8.zip
        You will need to host them yourself.

        3.8 is very old. Using 4.1 would be much better.

        Charles 谢谢你的回答,确实我更换为4.1后能够成功运行了,感谢你提供的思路。我已经解决问题了,谢谢。

        • Nate が「いいね」しました。