我一直在尝试让Physi.js在一个简单的离线项目中工作,虽然所有必需的脚本(Three.js,physi.js,physijs_worker.js,Ammo.js)都会加载并相互识别,但physijs_worker.js似乎没有正确地找到/使用ammo.js的一些构造函数。以下是我在运行代码时得到的错误:
下面是我的代码的所有相关部分:
在HTML中:
<script src="lib/three.min.js"></script>
<script src="lib/physi.js"></script>在Javascript中:
'use strict';
Physijs.scripts.worker = 'lib/physijs_worker.js';
Physijs.scripts.ammo = 'ammo.js';我摆弄了一下physijs_worker,试图自己解决它,但我不知道问题出在哪里。Ammo.js当然有physijs_worker.js正在尝试使用的构造函数,而且它们都正确加载。
快速编辑-如果相关,这里是我正在使用的所有库的源代码:
Three.js - https://github.com/mrdoob/three.js/
Physi.js - https://github.com/chandlerprall/Physijs
我使用的Ammo.js副本来自Physijs repo。
发布于 2019-07-06 16:25:52
我也有同样的问题,我设法通过使用Physijs的examples folder下的ammo.js文件而不是ammo.js存储库中的文件来解决它。
https://stackoverflow.com/questions/53379959
复制相似问题