How do I make a CameraActor my main camera?

Hi Guys,

For first off, I’ve spending good part of a week and bit rummaging through Unreal. I’ve built source and gone through examples, looked through docs, did some programming etc. My main background is from Unity side of things(6 years or so), including work as a C++ programmer.

I’m trying to implement, what I would consider, a basic element of a game and finding myself struggling. So I would like to get some input on best practices when tackling this kind of development problem.

In particular, a C++(potentially married with BP) solution would be awesome. So here goes:

Requirements:

  • Player is represented by a pawn that walks around a room(there are many, connected via triggers etc)
  • Player does not have a camera
  • Camera is a separate actor in scene and looks down at a room (perspective iso style)
  • When player exits room, camera moves to look at new room
  • Camera does not translate or rotate to view player. Camera is static

I’m not finding a way of actually setting a camera up that can stand alone, away from player. What should I be doing? Any help is welcome. Thanks peeps!

.

5 Likes

One thing you can do is to use a camera and a Matinee actor for every room. Set your camera in Matinee as you should for a cinematic(except for movement. you dont need to set more than 1 key for movement track since camera is static) and make sure you set a director track in it(which will enable you to view through cam) After that create Play node for every matinee in Level Blueprint, and activate them with those triggers you use for room switching.

Thank you very much Jacky. I’ll try that moment I get back home! :slight_smile:

So I worked it out. Just using BP and nothing else, you can achieve a completely disconnected and best of all free camera mode. Do this:

  • Add a CameraActor to your scene
  • Create a level blueprint(or any blueprint as long as it executes) :slight_smile:
  • Then make this:

So yes, it obviously doesn’t have to be a level BP, can be any BP.

4 Likes

Any idea how I can do this with only C++ code?

Hey dbrizov,

Probably best to ask that in C++ section of AnswerHub, where most of our coders hang out. Feel free to reference this post if you find it helpful. Thanks!

Great help thank you, this is exactly what I needed for my tower defense game, however I just currently have a static camera in corner. What is best way to pan camera around level?

Hey guys! Just can’t find the ‘SET’ box that is in picture, second red box that says ‘Find Camera Component when View Target’, where can I find it?

You don’t need that node anymore Charly. It should just work. Cameras are also getting a bit of a rewrite.

You can add a BP component to your stand-alone camera actor and have it do stuff on a tick. That way you can have it rotate and translate around level to track things etc.

In 4.10, you can place a camera actor, select it, scroll down details panel until you see “Auto Player Activation” and then select player that should use camera.

2 Likes

Hi. I want all players to use that camera actor. Is there any way to do it so I dont need to copy 16 cameras, one for each player? Thanks!

Do you want all players to ‘see’ through one camera, such as in spectator mode, or do you want to have a top-down view where all players are visible within scene?

In BeginPlay use this:
UGameplayStatics::GetPlayerController(GetWorld(), 0)->SetViewTarget(TPCamera);

Probably this is what you wanted and what you did?

Hi Everyone, this is works great, but how can I also take control of newly created cemera? Like a free flying first person view?

What needs to be included to get this line to compile?
Is this a dumb question? How could I figure this on my own?

@TommyBear As a newbie i looked all over for find a solution and this worked like a charm. Thank you so much.