Hey there, I'm just getting started with THREE.js and I'm trying to create a custom class that extends THREE.Mesh for my scene. My goal is to have the class contain an imported mesh via JSON loader, but so far all my attempts have not been successful.
Below is my code snippet:
THREE.ImportedMesh = function(){
this.type = 'ImportedMesh';
this.load = function(url){
var loader = new THREE.JSONLoader();
loader.load(url, function(geometry,materials){
THREE.Mesh.call(self,geometry,new THREE.MeshFaceMaterial(materials));
});
};
};
THREE.ImportedMesh.prototype = Object.create( THREE.Mesh.prototype );
THREE.ImportedMesh.prototype.constructor = THREE.ImportedMesh;
Unfortunately, I keep encountering these errors in the console:
Uncaught TypeError: Cannot read property 'remove' of undefined
Uncaught TypeError: this.updateMorphTargets is not a function
If anyone has any insights on how to resolve this, I would greatly appreciate it!
Thanks,
Rick