Box Geometry
const geometry = new THREE.BoxGeometry( 10, 20, 10, 1, 1 );
const material = new THREE.MeshNormalMaterial( {flatShading : false} );
const box = new THREE.Mesh( geometry, material );
scene.add( box );
animate();
function animate() {
requestAnimationFrame(animate);
box.rotation.x += 0.01;
box.rotation.y += 0.01;
box.rotation.z += 0.01;
renderer.render(scene, camera);
}
BoxGeometry(width : Float, height : Float, depth : Float, widthSegments : Integer, heightSegments : Integer, depthSegments : Integer)
creates a box of dimensionswidth
height
depth
.width
is considered along X-axis. Default: 1height
is considered along Y-axis. Default: 1depth
is considered along Z-axis. Default: 1widthSegments
,heightSegments
&depthSegments
are the number of segments used to construct each face.For making Cubes we just have to make
height
,width
&depth
equal.- This is the simplest Geometry.๐
๐คฉ Looking forward to hear from you.
ย