How to align camera to editor view?


#1

I found it extremely difficult and frustrating to align camera preview to match the scene view. It is extremely easy to do so in Unity.

I found this question was asked 2 years ago. @yaustar seemed to provide an answer, but I am not understanding his approach.

Can someone please explain @yaustar’s approach or suggest a easy way to solve this problem?


#2

Is your camera in game/app a static camera or one that moves/rotates?


#3

Hi @yaustar. Just want to align camera one time during the design of the scene. The camera does not move/rotate at runtime. But it really does not matter, because the alignment is one time only (see the bottom paragraph).

It seems this is a very simple thing for PlayCanvas Editor to do: Since PlayCanvas Editor knows how to render the scene-design-view, so it already knows the transform to use for the rendering. This is the transform of the scene-design-view-camera (if there is such a thing). So PlayCanvas Editor just need to has a menu item that copy such transform to any camera in the hierarchy. This way, both the scene-design-view and camera-preview would match, for that instance only of course.

The alignment is one time only! It is like taking a snapshot. I am not talking about aligning camera during runtime, because it does not really make much sense. When the game runs, game designer does not continue manipulating the scene-design-view any more, hence there is no question of alignment any more. In any case, the camera’s lookAt at runtime is best done with scripts.


#4

If it’s just one time, try this.

In the editor, change the name of the camera to Camera (yes, this is important, I don’t why).
image

Change the view to camera:
image

Use WASD (forward/back/strafe), QE for panning up and down and left click/right click mouse move (I think one does orbit and the other rotates the camera?) in the Editor view to move the camera as though it’s a fly/FPS camera.
May-16-2019%2013-46-43

Remember to change the view back to perspective and rename the camera to what it should be.

@vaios Can this be added to the Editor ‘nice to haves’ please? Being able to move a camera or entity to the position and rotation of the Editor view.


#5

@yaustar. Thanks,

Wow, it is easy and straight forward, if you know the trick!

This trick is NOT immediately obvious. Please make it a single click of a menu item to align a camera to the current scene view transparently (without renaming/toggling camera name back and forth).