[SOLVED] How to get the camera rotation in the editor viewport

Hi,

in a project I show rooms represented by 360 images and links on doors to be able to »move« from room to room. After a click on the link the room image is changed and the links are changed to the links related to that room. The new room is rotated so that the users get the impression they went through the door and look at the wall opposite of the door. The whole setup works as expected.

But it is not easy to determine the room rotation, it needs a lot of debugging the camera rotation in the new room. When I could get the camera rotation in the editor I could set the room image, rotate the view accordingly in the editor and read the camera rotation. This workflow would be very convenient.

Is it possible to get the camera rotation via the editor api like “window.editor.api.camera” or something similar? I checked the documentation and the methods and properties of the editor.api but could not find out how to get the camera rotation.

So currently the entities exposed by the Editor API are only only scopes to the Root entity viewable in the hierarchy. You can select the current viewport camera to be the one from your scene by changing it from the top right here:

Then you can access its rotation through the editor.api.globals.entities.* path in the editor window.

I hope this helps :slightly_smiling_face:

1 Like

Thanks @KPal, to change the viewport camera to the scene camera is even better, then I can read the values directly in the editor. Thanks a lot for your answer.

1 Like

Now I would like to add “[SOLVED] ” to the title, but I can’t edit the title. How is editing the title possible for me?

Don’t worry I have done it for you.

:+1: