Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CubeGeometry VS BoxGeometry in Three.js?

Tags:

three.js

I am learning Three.js. I can't find a proper answer about the difference between CubeGeometry vs BoxGeometry. I am getting the same output for both. Please help.

CubeGeometry:

var geomatry = new THREE.CubeGeometry(100,100,100);
var material = new THREE.MeshLambertMaterial({color:0XF3FFE2});
var mesh = new THREE.Mesh(geomatry,material);
mesh.position.set(0,0,-1000);
scene.add(mesh);

BoxGeometry:

var geomatry = new THREE.BoxGeometry(100,100,100);
var material = new THREE.MeshLambertMaterial({color:0XF3FFE2});
var mesh = new THREE.Mesh(geomatry,material);
mesh.position.set(0,0,-1000);
scene.add(mesh);
like image 517
Kamran Sohail Avatar asked Aug 31 '26 10:08

Kamran Sohail


1 Answers

CubeGeometry is just an alias for BoxGeometry. Keep in mind that CubeGeometry is actually deprecated.

https://github.com/mrdoob/three.js/blob/4888a99ca0161f2b5fea0e9ae9ce845891c50999/src/Three.Legacy.js#L80

like image 178
Mugen87 Avatar answered Sep 06 '26 09:09

Mugen87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!