Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
What is the proper use of threejs Box3().getSize() method?

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?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

You're expected to pass in a vector into which the result will be written:

// ...

let boxSize = new THREE.Vector3();
cubeBoundingBox.getSize(boxSize);

console.log("BoxSize: " + boxSize);
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!