我还是个新手...
main.js
import * as THREE from 'three'
import Box from './classes/Parts.js'
const box = new Box()
scene.add(box)
Parts.js
class Box {
constructor() {
this.geom = new THREE.BoxGeometry(2, 2, 2);
this.mat = new THREE.MeshBasicMaterial({
color: 0xff0000
});
this.mesh = new THREE.Mesh(this.geom, this.mat);
}
}
export default Box;
但我得到这个错误:THREE.Object3D.add: object not an instance of THREE.Object3D.
我做错了什么?