I've really tried my best to solve this with my own research, but unfortunately I'm an absolute novice with three.js and javascript and I really need some help.
I am trying to import a model from threex (google threex -- I can't post another link) into my three.js scene. Unfortunately, when I add the code to do so as follows:
var spaceship = null;
THREEx.SpaceShips.loadSpaceFighter03(function(object3d){
scene.add(object3d)
spaceship = object3d
})
I end up with a blank scene, and this error in my javascript console:
Uncaught TypeError: (intermediate value).fromArray is not a function.:8000/bower_components/threex.spaceships/examples/vendor/three.js/examples/js/loaders/MTLLoader.js:299
Which leads me to the (supposedly) offending line of code in MTLLoader.js (whatever that file is.)
params[ 'ambient' ] = new THREE.Color().fromArray( value );
I don't know what's happening, and I'm in a bit over my head I think. Does anybody know how to fix this?
I am working off of this tutorial: 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 -- I can't see any problems -- I've so far tried to follow the steps very closely.)
Thanks in advance.
This is a version incompatibility between current three.js and the code used from that threex. Threex is compatible with a version of three.js that is a year old.
When learning three.js, this has good advice: Learning WebGL and three.js
The version of three.js that threex uses can be seen in https://github.com/jeromeetienne/threex/tree/master/vendor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With