Get OrbitControls Azimuth Angle

I used BoxGeometry to make a big Rectangle - which kinda looks like a Wall basically, and I’m using OrbitControls to rotate around it. I need to find out when during my rotating around this Wall I’ve crossed the 180 degree line so that I’m now behind it.

I know the latest version of OrbitControls.js has a .getAzimuthalAngle() function, but when I downloaded this latest version it pretty much ruined some key functionality that I had working perfectly – and I just don’t have the time/resources to try and figure out what’s going on and rework everything.

Is there some other way to try and figure out this angle/behind-the-wall situation?

Hi!
The plan is:

  1. Set wall’s normal, that defines wall’s front.
  2. Convert camera’s position in wall’s local space.
  3. Normalize that vector.
  4. Find the dot-product of wall’s normal and normalized camera’s position.
  5. If the result is less than 0, then the camera is behind the wall.

Example: https://jsfiddle.net/prisoner849/4yckxLmd/
Picture:

1 Like

OK… :innocent:

Other than me not knowing what:

  1. EdgesGeometry was - or that such a class even existed in THREE
  2. what “Euler” was - or that it even existed
  3. what LineSegments were - or that such a class even existed in THREE
  4. what worldToLocal was

etc…

Other than all that - I was totally fine! :nerd_face:

Love how you used CylinderGeometry with only 4 radialSegments to make a Square. That’s so devious! Cause I was like “this says ‘Cylinder’, shouldn’t I be seeing a Cylinder somewhere? All I see is like a cube…”

Bottom line: quite the lesson Sir! Very educational.

And I have MUCH to learn!

Thanks a million!

You’re welcome :beers: