Download

Switching Cameras

I’m trying to implement a camera system where say if players presses F1 it will switch First person mode and then switch back 3rd person mode.What is the better approach?Having 2 camera components on blueprint?I couldnt seem to find a tutorial on this.

Instead of using two cameras, you can have a SpringArmComponent attached to the root. When you switch to third person, attach the camera to the SpringArmComponent, otherwise attach the camera to the root component directly. You would need to set UseControllerViewRotation for the camera accordingly and also reset the pitch of the relative camera rotation to 0 after switching to third person.

In the next release you can use the ‘Activation’ state of a CameraComponent to enable/disable it, which would make your ‘2 camera component’ approach work well. For now, doing as cbuttner suggests will work I think, or you can override CalcCamera to choose which camera component to use (see AActor::CalcCamera).

Thanks James!

Can Blueprints be used to overide CalcCamera?

Not currently, but it is something we are discussing.