Rotate an 'ArcRotateCamera' around its "target" axis

Hello all,

I have a camera of type ArcRotateCamera which is ponting to my target. I have been able to rotate the camera around my target by setting alpha and beta properties correctly. But what if I want to rotate this camera around its axis? Is it possible?

To pose an example: Imagine an ArcRotateCamera pointing to a person. Depending on how you move the mouse (or set alpha and beta) you will be able to see this person’s shoulders, back, face, etc, but all of it while the person stands in a normally vertical position (head above the feet). What if I want to rotate the camera while focusing on the person’s face, such that at some point I see the person upside down? (feet above the head). Is this possible with this type of camera? If so, how can it be done?

Thank you

I haven’t tested this idea, but what if you define an invisible object that the camera points to and then rotates that object around the camera?

This might help. The upVector controls the rotation of the camera about its axis Babylon.js Playground

Thank you for the advice @JohnK . I had found upVector and I was playing with it a bit, but I’m not sure it is what I am looking for. Nevertheless, it is the most promising solution I have found so far, so I’ll keep working on it. I have a concern about this property though.

Your playground example functions very smoothly as you are rotating it with the Math functions, however it faces the same issue I’ve seen in my models, and it is that if you try to set the up vector to (0, -1, 0), the animation doesn’t function as it should. However, (-1, 0, 0) and (0, 0, -1) values work perfectly fine. I have just edited one line over your playground to show this:

Is it a bug, or is there some theory behind what values this property can have that I am missing?

When browsing through the ArcRotateCamera documentation (Cameras - Babylon.js Documentation) it specifies that beta=0/PI can cause problems. If both (0, 1, 0) and (0, -1, 0) upVectors gave errors I could understand that it is related, but since (0, 1, 0) upVector works fine, are these two things somehow related?

Hi @Necips, thank you for your answer. I think that wouldn’t work, since rotating a mesh (around its origin) does not change the position/orientation of the camera pointing to that mesh, and if I were to rotate the object around the camera, then the camera would stop pointing at this person that I used as an example. It might be that I didn’t understand fully your suggestion, so I would appreciate it if you saw that I got the wrong idea and we could discuss it further.

what you want to get is something like this?Virtual Eye BETA
It is a art rotate camera, but when you want to zoom-in, you get a new target, and the camera rotate itself along the axis defined from new target and you current camera position, means the alpha beta radius change from the old to a new alpha beta radius?

1 Like