ArcRotateCamera rotate behavior on north Pole and sud pole


First let me explain the behavior,
When the camera is under or on top of mesh. Like a satellite to be on north pole or sud pole, and then you drag the mouse to the right or left, the floor rotate on himself.

But I want to know if there is a way to use the ArcRotateCamera but instead of just rotate on himself the camera will rotate around the mesh.

I want to do something like this playground:
But with moving the camera and not changing the rotation of the mesh.

Thank you.


Welcome to the forum !!!

@PolygonalSun who is coming back next Monday might have a trick for you :slight_smile: also adding @Cedric who might have done smthg for this recently ??? (completely unsure… I am getting old)

Thanks for the quick reply!
Will stay tuned for the return of your friend!
Have a good day

1 Like

I think I see what you want: moving mouse left right, will always rotate camera left/right whatever is its previous orientation.

I’ve started a quick test but I don’t get the intended result. In substance, I would do what’s been done in and attach the camera to it.

AFAIK, there is no such camera behavior in babylonjs by default but I might be wrong.

I think I didn’t explain it clearly because I have trouble explaining it, but it seems that the camera rotate well around the mesh most of the time, but for some unknown reason when you got to the top of the mesh (north pole) or the bottom (sud pole), and then you want to continue to rotate the camera around the mesh, you drag the mouse left or right but the camera rotate on himself instead of rotate around the mesh.

Maybe this PG will be easier to show the behavior:
Turn the mesh cube until you see the 5 number and then drag the mouse right or left and you will see the 5 number rotating.

Setting beta to 0 or PI can, for technical reasons, cause problems, so in this situation, beta is offset by 0.1 radians (about 0.6 degrees).

From Camera Introduction | Babylon.js Documentation

See also ArcRotateCamera shifts axis at beta 0 or PI

Thank you, but I have the beta set to Math.PI / 2 and still have the same behavior.

I’m a little out of my depths here, but I think I understand what you want.

What beta you set on your camera at start doesn’t matter since it will change as soon as you move your camera. I think @JohnK was referring to the weird change in rotation direction that often happen when you reach the exact north or south pole. But I don’t believe this concerns you since you don’t want this rotation at all, no matter the direction.

I think this describes pretty well what you want. And if that is the case, I’m afraid the only solution is to rotate the mesh according to the mouse input, instead of moving the camera. Because here, that would mean that alpha-betas on camera move would depend on curent alpha-beta. Wouldn’t this mean a depth overflow because of recursive dependance ?

i think i understand . basically the arc rotate camera works with alpha ,beta ,radius properies and , alpha and beta works like constant x and y world axis so you can’t rotate it relatively to it self . what u have to use is a freeCamera with the method of target to target the mesh u want ,then u can rotate it on it local axis

1 Like

A big thanks to all of you for all the answer, I think I have more understanding of how the camera interact and work with the scene now. I have many feature using the ArcRotateCamera in my project so I will leave it like this for now and live with the behavior but I will surely try the freeCamera for my next upgrade.

I will tag Nova_hovekh answer as the solution but all of you really help thanks again!

Have a great day!