I\'m new to THREE.js coming from an AS3/Away3D background. I\'m trying to create a custom object class that extends THREE.Object3D to add to my scene. CustomObject will encapsul
If you want to add your custom object to the scene directly, you can use a pattern like this one:
function CustomObject() {
this.type = 'CustomObject';
this.geometry = new THREE.BoxGeometry( 540, 540, 14 );
this.material = new THREE.MeshLambertMaterial( { color: 0xff0000 } );
THREE.Mesh.call( this, this.geometry, this.material );
}
CustomObject.prototype = Object.create( THREE.Mesh.prototype );
CustomObject.prototype.constructor = CustomObject;
CustomObject.prototype.getMesh = function() {
return this.mesh;
}
var foo = new CustomObject();
scene.add( foo );
three.js r.71