我正在尝试THREE.Mesh
像下面这样子类化(THREE.Mesh继承自THREE.Object3D)。
Planet = function(geometry, material) {
THREE.Mesh.call(this);
this.geometry = geometry;
this.material = material;
};
Planet.prototype = Object.create(THREE.Mesh.prototype);
当我传入 a 时,它似乎工作正常SphereGeometry
,只是没有像我只使用 a那样设置boundRadius
属性。场景绘制正确。 THREE.Mesh
但是,当我传入 aCubeGeometry
时,渲染循环变得非常不开心。
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)
我模仿了Three.js
使用. 我一定是错过了什么。THREE.Object3D
THREE.Mesh