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

157
Views
Three.js Update an object's position relative to another object's scale

I dont know who needs to see this, just wanted to share a solution for a problem I encountered recently. I hope it helps someone.

Lets say you have an object House and inside that House you have another object Chair in a very specific spot. you scale the House's Size by 2, making it bigger. The Chair then is not at the same spot inside the House because the House's size is different. you need to move the chair to that very specific spot without doing it manually.

EDIT Moved the solution to an answer

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

this is the formula you would use: ( (Chair.position * House.scaleFactor) - (House.position * (House.scaleFactor - 1)) )

In Threejs code it would look something like this:

const scaleFactor = 2;
house.scale.setScalar(scaleFactor);
chair.position.set(
                    (chair.position.x * scaleFactor) - (house.position.x * (scaleFactor - 1)),
                    (chair.position.y * scaleFactor) - (house.position.y * (scaleFactor - 1)),
                    (chair.position.z * scaleFactor) - (house.position.z * (scaleFactor - 1))
                );
about 4 years ago · Juan Pablo Isaza 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!