I recently discovered that OrbitControls’s rotation can be bounded using minAzimuthAngle/maxAzimuthAngle/minPolarAngle/maxPolarAngle. It works as intended, however, whenever the camera hugs the boundaries, it makes a parallelogram . Is there I way I can make it elliptical instead?
not really, no. you would have to put your own code to do that.
Yes, with dynamic bounds of azimuth and polar angles – i.e. you have to recalculate the bounds depending on the current position. Here is a demo, the red points on an invisible sphere correspond to the current azimuth and polar angles of the controls:
Oh I see, so I’ll need to update the values dynamically. Thanks alot!
What I do is the following:
- if the angular coordinates are within a predefined angular circle, then I do nothing
- if they are outside this circle, I force them back to the circle – to do this, I set the min/max of both azimuth and polar angles, and after
controls.updatethat uses the bound angles, I release back the bounds
Here is the code:
GOAT! I definitely appreciate it!