mrdoob/three.js — Issue #1244: Animation, textures and JSON
Author: aphex-
Created: 2012-02-03 17:38:05+00:00
State: open

Hello,
I try to animate a textured character which is loaded with a THREE.JSONLoader. The model was exported from Blender and contains UV's and MorphTargets. The code to animate it is taken from this tutorial: http://catchvar.com/threejs-animating-blender-models
The animation works fine if I dont use a textured material. If I use textures like THREE.MeshFaceMaterial or THREE.MeshLambertMaterial the model will be drawn without any animation. This is the code to initialize my mesh.

```javascript
var Player = function(){
var self = this;
this.mesh;
// textured but no animation..
//this.material = new THREE.MeshLambertMaterial({map: THREE.ImageUtils.loadTexture(Configuration.Game.Player.textureFile) , overdraw: true});
//this.material = new THREE.MeshFaceMaterial({ morphTargets: true });
// animated but no texture..
this.material = new THREE.MeshLambertMaterial( { color: 0x606060, morphTargets: true } );
this.loader = new THREE.JSONLoader(true);
this.loader.load({
model : "Models/texture.jpg",
callback : function(geo) {
geo.computeVertexNormals();
geo.materials.shading = THREE.FlatShading;
self.mesh = new THREE.Mesh(geo, self.material);
// the meshtype seems to make no difference..
//self.mesh = new THREE.MorphAnimMesh( geo, self.material );
self.mesh.castShadow = true;
self.mesh.receiveShadow = true;
scene.add(self.mesh);
}
});
};
```
I will also upload the JSON-file if this is helpfull.