- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我真的尽了最大努力通过自己的研究来解决这个问题,但不幸的是,我是 three.js 和 javascript 的新手,我真的需要一些帮助。
我正在尝试将模型从 threex(google threex——我无法发布另一个链接)导入到我的 three.js 场景中。不幸的是,当我添加如下代码时:
var spaceship = null;
THREEx.SpaceShips.loadSpaceFighter03(function(object3d){
scene.add(object3d)
spaceship = object3d
})
我最终得到一个空白场景,并且在我的 javascript 控制台中出现了这个错误:
Uncaught TypeError: (intermediate value).fromArray is not a function.:8000/bower_components/threex.spaceships/examples/vendor/three.js/examples/js/loaders/MTLLoader.js:299
这让我想到了 MTLLoader.js 中(可能)有问题的代码行(无论那个文件是什么。)
params[ 'ambient' ] = new THREE.Color().fromArray( value );
我不知道发生了什么,我想我有点不知所措。有人知道如何解决这个问题吗?
我正在完成本教程:https://www.youtube.com/watch?v=vw5_YyM4hn8 (如果有帮助,可以在此处找到本教程该部分的示例代码:https://github.com/jeromeetienne/flying-spaceship-minigame/blob/master/step1-01-naked-spaceship.html -- 我看不出有任何问题 -- 到目前为止,我一直在努力严格按照这些步骤进行操作。)
提前致谢。
最佳答案
这是当前 three.js 与该 threex 使用的代码之间的版本不兼容。 Threex 兼容一年前的 three.js 版本。
在学习three.js的时候,这个有很好的建议:Learning WebGL and three.js
threex使用的three.js的版本可以在https://github.com/jeromeetienne/threex/tree/master/vendor中看到
关于javascript - Three.js + Threex + Javascript : "fromArray is not a function"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30002500/
我真的尽了最大努力通过自己的研究来解决这个问题,但不幸的是,我是 three.js 和 javascript 的新手,我真的需要一些帮助。 我正在尝试将模型从 threex(google threex
我是一名优秀的程序员,十分优秀!