Everywhere on stackoverflow et al seem to agree that the proper use of the Box3() getSize()
method is as follows:
const geometry = new THREE.BoxGeometry( 10, 10, 10 );
const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );
let cubeBoundingBox = new THREE.Box3().setFromObject( cube );
let boxSize = cubeBoundingBox.getSize();
console.log("BoxSize: " + boxSize);
However this doesn't seem to be the case. See the error in this example: https://jsfiddle.net/8L5dczmf/3/
I can see in the three.js documentation that getSize()
is in fact supposed to be used this way... unless I'm reading .getSize ( target : Vector3 ) : Vector3
incorrectly. What is wrong with the code in the fiddle above then?
target
param togetSize
, but appears that it's actually thatgetSize()
doesn't exist (althoughtsize()
does) – Haphtarah