4

Exporting some obj models from Blender to json with three.js plugin result in javascript errors in my web page. The error is always like

TypeError: vertices is undefined

In Three.js at line

zLength = vertices.length;

The json file do not seems to be correctly formatted, what to change ? How to create a correct obj file ?

The json files are really different in format, and the node "vertices" does not appear as a root node but inside of embeds nodes:

"embeds" :
{
"emb___9903__30_1 __9903__30_1_8.002": {    "scale" : 1.000000,

"materials" : [],

"vertices" : [...]}

This format does not seems to be correct but I don't know what to during the export in json or the creationg of the obj file.

The html/js web page seems to works correctly because some file is correctly open in the browser

Basically I do:

function init()
{
...
var jsonLoader = new THREE.JSONLoader();
jsonLoader.load( "models/model.js", addModelToScene );
...
}

function addModelToScene( geometry, materials ) 
{
    var material = new THREE.MeshFaceMaterial( materials );
    modeltd = new THREE.Mesh( geometry, material );
    modeltd.scale.set(1,1,1);
    scene.add( modeltd );
}
4

1 に答える 1