Camera first person view

Hi, I’m trying to figure out how to stand on ground and look around. When using free-look (left drag and shift) the camera always gets a strange rotation. Is there a way to disable this?

To pan around, you can hold down the left mouse button and drag. To rotate, you can hold down the scroll button and drag. Do those keys achieve what you wanted to do?

Hi, thanks for your reply!

What I’m looking for is for the camera to rotate around a fixed axis. Think of it as Google Street View. It excludes the possibility that an axis changes orientation. You can only rotate around a fixed point, which in this case is the point of the camera.

@ariel

Thank you for your follow-up post! I just took some time to look through the Camera object in our API. I suspect that the member constrainedAxis has the functionality that you are looking for.

https://cesium.com/learn/cesiumjs/ref-doc/Camera.html?classFilter=Camera#constrainedAxis

Please let me know if you have any questions or concerns! I am looking forward to learning more.

-Sam

Hey Sam, thanks for your reply.

I did play around with constrainedAxis but it didn’t give me the expected results. Seems like it just keeps the camera from rotating past the given axis, it doesn’t lock the camera in place. Even If I place the camera on the exact given point, the camera only rotates perfectly around that point when looking straight up or straight down.

For now, my temporary solution is to listen to camera changes and set camera.roll to 0. It’s not pretty, but it works :slight_smile:

@ariel

Understood - it seems like you have taken the time to look through our documentation. Overall, I am really happy that you have found a fix. Setting Camera.roll to 0 works - I will let you know if I find a more elegant solution.

-Sam

@ariel Hi,
I facing the same problem - using the Sandcastle Camera Tutorial, but when in first-person mode, the camera keeps rolling. Can’t find a way to either lock the roll to 0, or correct it.
Please help