I am trying to subclass THREE.Mesh like below (THREE.Mesh inherits from THREE.Object3D).
Planet = function(geometry, material) {
THREE.Mesh.call(this);
this.geometry = geometry;
this.material = material;
};
Planet.prototype = Object.create(THREE.Mesh.prototype);
It seems to work fine when I pass in a SphereGeometry, except that the boundRadius property is not set like it would be if I were using just a THREE.Mesh. The scene draws correctly though.
However, when I pass in a CubeGeometry, the render loop becomes very not happy.
Uncaught TypeError: Cannot read property 'radius' of null three.min.js:105
THREE.Frustum.intersectsObject three.min.js:105
render three.min.js:414
starsgl.Application.render Application.js:60
starsgl.Application.animate Application.js:55
starsgl.Application Application.js:50
(anonymous function)
I imitated the way that Three.js was subclassing THREE.Object3D with THREE.Mesh. I must be missing something though.
radius isn’t called because geometry isn’t set.