4

I have a 3d model in the format of 3ds. I converted it to obj and then to js format. Now i want to load it in another js file. That's my code for the loading:

var loader = new THREE.JSONLoader();
loader.load( { model: "untitled.js", callback: createScene } );



function createScene( geometry ) {

geometry.materials[0][0].shading = THREE.FlatShading;
geometry.materials[0][0].morphTargets = true;

var material = new THREE.MeshFaceMaterial();

var mesh = new THREE.Mesh( geometry, material );
mesh.scale.set(50, 50, 50);

scene.addObject( mesh );
}

the web developer console show me the error: TypeError: a.split is not a function Three.js:119

How can i fix this? Thanks

4
  • what did you use to make the js file? (is it in the JSON 3 model format?) ref:github.com/mrdoob/three.js/wiki/JSON-Model-format-3.0 Commented Aug 14, 2012 at 20:41
  • I used blender with different python addon files and exported it as a js file Commented Aug 14, 2012 at 20:43
  • I can't tell by looking at your code, but it seems to be related to the parsing, try commenting the contents of createScene and see if the error still occures. If there is still something wrong then the json creation was false.. You could maybe try to fix it manually... Commented Aug 14, 2012 at 20:47
  • the error still occurs, even with the createScene content commented Commented Aug 14, 2012 at 20:54

1 Answer 1

3

Should be this instead:

loader.load( "untitled.js", createScene );
Sign up to request clarification or add additional context in comments.

1 Comment

now it says geometry[0][0].materials is undefined. i think the untitled.js file is not okay

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.