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

196
Views
How to perform relative rotations to other objects threejs?

I am trying to make a perspective camera go through a portal like in the game Portal, and rotate relative to the portal face it comes out of so you are facing the same way the exit portal is facing while keeping the same viewpoint you had when entering a portal. I have tried to implement this using getWorldDirection() like so:

      var portalNormal = new THREE.Vector3();
      portal.getWorldDirection(portalNormal);

      var exitPortalNormal = new THREE.Vector3();
      exitPortal.getWorldDirection(exitPortalNormal );

      var camNormal = new THREE.Vector3();
      camera.getWorldDirection(camNormal);

      camNormal.add(portalNormal);
      camNormal.sub(portalLinkNormal);

      camera.lookAt(camNormal)

This code seems to almost work, but the camera never rotates quite right. Thanks for the help! And also let me know if I'm asking the right question because I'm not sure quite how to word it.

about 4 years ago · Juan Pablo Isaza
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!