webgl-threejs-hello/app/js/components/Bean.js
2018-10-11 04:24:57 -04:00

28 lines
619 B
JavaScript

import props from 'js/core/props';
class Bean extends THREE.Object3D {
constructor() {
super();
this.radius = 1;
const material = new THREE.MeshStandardMaterial({
color: '#FFFFFF',
});
const geometry = new THREE.SphereGeometry(this.radius, 20, 20);
this.mesh = new THREE.Mesh(geometry, material);
this.mesh.castShadow = true;
this.add(this.mesh);
this.position.z += this.radius / 2 + 0.01;
this.onUpdate = this.onUpdate.bind(this);
}
onUpdate() {
// this.rotation.x += props.rotation;
// this.rotation.y += props.rotation;
}
}
module.exports = Bean;