[Solved] OrbitControls max polar angle = Infinity?

Hello everyone,
First, I want to thank all the people working on this awesome library! I hope one day I’ll join you as well.
I started using it recently, so please be gentle if my question is somehow stupid :innocent: .
So, my question is very simple : why is Orbitcontrols max polar angle clamped at math.pi?
I want to have something like trackballControls which can rotate my camera to infinity vertically .
If I’m not wrong trackball is deprecated.
Is there a way to do this ?

There is no such thing as a stupid question but this one… nah I’m kidding :slight_smile:

Imagine you’re in a museum and your observing a vase that’s on a stand in the middle of the room. You can crouch, you can rise up on your toes, stick your head real close to the glass. The floor is below you, the ceiling is above you no matter what you do.

Go around the stand, still the same situation.

What would happen if you grabbed the vase and did a hand stand? Trackball controls.

If you go past the pi limit you end up upside down and it’s simply ends up not being orbit controls.

There is a gimbal lock problem but i think that can be avoided, but i think the end result would feel weird. Once past the limit you’d only be upside down (not sideways) so you’d end up doing the same thing the orbit controls do normally just upside down. Until you go past the poles again, and flip back. Where would this be useful?

1 Like

A more technical answer to this limitation is the relation of OrbitControls to the lookAt() function. @WestLangley has described this fact in the following thread:

When the camera passes over the “north” and “south” poles, it flips so as to stay right-side-up. The camera’s up-vector is (0, 1, 0) by default.

The limitation of the polar angle is necessary to avoid these mentioned flips. lookAt() needs the rotation of the camera but also the up vector for correct orientation.

So no, with the current implementation of OrbitControls it is not possible to implement your desired behavior.

That’s new to me. Where have you read that?

Thanks for your reply. Very explanatory example, I understood the issue clearly!

Thanks for your reply!

I got the general idea. I see now why it’s implemented this way.

Well actually i couldn’t find it anywhere on the documentation(if i’m not wrong again, it used to be along with other controls) .
Plus all the posts I saw regarding it were at least one year old, and I couldn’t properly import it from the npm three module so I assumed it was not used anymore.
Anyway I imported it manually from js/example/controls and it seems to be working great. :sunglasses:
EDIT : Spell check + got it to work

1 Like