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

183
Views
Three.js Set relative position to another Object

Recently, I've been working on a video game with Three.js and I want the up arrow key to go forward relative to the camera.

Here is my code for the arrow key.

var x = 0;
var rotx = 0;
setInterval(function() {
    if (x == 1){
        camera.position.z += 0.05
    }
}

    document.addEventListener("keydown", function(event){
        if (event.key == "ArrowUp"){
            x = 1
        }
    });
    document.addEventListener("keyup", function(event){
        if (event.key == "ArrowUp"){
            x = 0
        }
});

Many times I've been searching for the answer. Usually coming across both

object.localToWorld();
object.worldToLocal();

but I can't seem to understand how to use this method.

about 4 years ago · Santiago Trujillo
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!