Three.js + Threex + Javascript: "fromArray is not a function"?
Three.js + Threex + Javascript: "fromArray is not a function"?
我已经尽力通过自己的研究解决了这个问题,但不幸的是,我是 three.js 和 javascript 的绝对新手,我真的需要一些帮助。
我正在尝试从 threex(google threex -- 我不能 post 另一个 link)导入一个模型到我的 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 (if it helps, the sample code for that segment of the tutorial is found here: 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
中看到
我已经尽力通过自己的研究解决了这个问题,但不幸的是,我是 three.js 和 javascript 的绝对新手,我真的需要一些帮助。
我正在尝试从 threex(google threex -- 我不能 post 另一个 link)导入一个模型到我的 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 (if it helps, the sample code for that segment of the tutorial is found here: 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
中看到