Reputation: 147
hi i have a simple TheeJS code which i want to load some 3D js files using JSONLoader in it. the 3D files were exported from blender exporter and when i run this part of code it get me two errors:
Uncaught TypeError: Cannot read property 'map' of undefined
Uncaught TypeError: Cannot read property 'attributes' of undefined
and this is a little part of my code which is going to load the json 3D file:
var load = function ( file, callback )
{
var loader = new THREE.JSONLoader();
loader.load( file, function( geometry, materials ){
callback( new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) ) );
});
}
load("models/porsche.js", function(car){
car.position.set( 0, 0, -2 );
car.rotation.y = Math.PI / -2;
scene.add(car);
});
Also when i use other kinds of Materials for example phong or lambert it works very well but it gave these errors when i use MeshFaceMaterial
What Should i do?
Upvotes: 0
Views: 563
Reputation: 71
Maybe the problem is in the json file, check if the pataramer shading is correct in the material. Some as "shading" :"Lambert".
Upvotes: 1