Managing cameras

Hello! I’m testing multiplayer top-down view strategy-like game. And I use classes derived from SpectatorPawn, PlayerController, GameMode. I start game (Multiplayer Options: Number of players set to 2) and I take screenshot

Screenshot taken in paused and possesed mode so main viewport should be a viewport of camera that belongs to first Logged-In player (PlayerController).
My SpectatorPawn class contains own CameraComponent so I expect player will see world through this camera.

So I want to know:

  • Who creates CameraActor8 and CameraActor10 ?
  • Through what exactly camera player sees world (no one from either
    selected CameraActor8 and MtSpectatorPawn8 shows me what I see in main viewport) - there is another camera?
  • Which guidelines I must follow to set and manage own camera?
  • Who creates CameraActor8 and CameraActor10 ?

I have investigated creation of cameras and looks like default CameraManager implementation needs to AnimCameraActor. So let it be this way.

Still can’t understand how to properly manipulate Camera rotation. I must do that through PlayerController or through Pawn?..

Hello zx.local,

First, I’ll try to explain you the Camera stuff in UE4.

Almost all infos i’ll talk can be found here: Camera documentation

You have 3 “groups” of stuff that can manage the camera.

Camera Component.

Actor / PlayerController

PlayerCameraManager.

The first one Camera Component as his name intend is a component so it can attached to an actor or a pawn. It contains a bunch a stuff (but not all in my opinion) to control the camera. It can be great for a quick camera setup. They use often in game samples such as the FPS, TPS, Vehicule and many others.

The second Group is Actor and PlayerController. Both contains a method to manipulate the behavior of the Camera with the function CalcCamera. You can manipulate the resulting output quite easily.

The third one is the PlayerCameraManager. This is a class that define everything you need for a camera. With that class you have a total control on what happens to the camera. You can derived from that class to create your own Camera and the behavior that come with it. The PlayerCameraManager is hold by the PlayerController.

All these 3 groups has different levels of possibilities and it’s really depends on your need, but you always need to take care of the chain of responsability. The engine go through this stack to check who is in chrage of the Camera. You may refer a the link for more infos.

If you want a custom camera and a particular behavior you can go with the PlayerCameraManager.You will have a total control.

Also you asked, through wich camera the player see the world, if i’m not mistaken, and you take the Top Down Sample, the camera you see through is a CameraActor attach to the character.

If you need more infos, details or anything else don’t hesitate.

I’m glad to help.

gamer08