How can i chose a camera to use?

Say i have 3 cameras in the level, and i just want to know how to select one of it to use? like change from Camera No.1 to Camera No.2?
thx for replay.

if you want to do something like resident evil classic camera switching, then use trigger box and then have your invisible pawn move to certain location and copy the camera info(ie position/rotation) to your pawn camera.

if you can’t figure out how to do this, better go through the tutorials in sticky post.
and then post more specific details about how and why your blueprint doesn’t work.

You can drag your camera components to the graph, drag off and select set active, making the 2 you don’t want false and the other true ect, and use a trigger box to cause this to happen.

I am interested in this camera stuff and I think I’ve seen most of the tutorials, can you point me to one that uses cameras that aren’t directly tied to the pawn?

unfortunately, as far as I know UE4 will tie a player controller to a pawn no matter what.
so if you don’t have a pawn or got destoryed, you will revert and possess a DefaultPawn.

There are proxy control threads and answerhub question about how to control pawns with out direct possess them.(ie RTS type of control)
but I don’t think there is a tutorial specifically does this. It’s doable if you understand the basics of how things work.
I’ll just outline something really straight forward.

  1. you have extended default pawn as your starting pawn.
  2. you lay out several camera in level, you can wrap camera in a BP to follow things when in range.
  3. when game starts, you move default pawn to whatever first camera in the scene, keep camera reference.
  4. spawn a Pawn(can be AIPawn) and then keep a reference in your controller.
  5. when you click or have input, use the value you get in controller and pass them to Pawn’s event/function.(like simpleMoveTo)
  6. when that remote controlled pawn enter/trigger a camera switch volume, move your pawn to next camera position and sync it’s position/orientation.
  7. if the camera does follow remote controlled pawn, update your camera when the update happens.( either passively from event or actively using tick)

These points, although never put together in a single tutorial/thread, but separately already mentioned somewhere.(maybe not point 7)
So after following official tutorials and have a good grasp of how UE4 works, this is pretty straight forward.

I am going to hijack this thread to ask
about camera stuff
Can someone give me the exact method for creating a cameraBP (which bad class?) and having the player controller tell it what to follow and tell it to be the camera that is in use. also I will use this camera to follow the pawn from a distance, in what BP should I put the EveryTick->(follow pawn from a distance code) code?
And will I need to spawn this BP or not

I need to be able to do this WITHOUT having an code in the level blueprint or in the pawns themselves. From my understanding I should be able to contain it all in the player controller and cameraBP

for some reason this is giving me significantly more problems that I would have expected

hi, guys, thx. I am figure it out.
Thank you very much.

@rodstone
cameraBP, start a Pawn blueprint, put a camera component. make a vector that camera will follow or lookAt. implement a interface so PC can pass a object and you update vector with object’s location.
Create PC, which can call getAllActorsOfClass, you can collect remote pawn or cameraBP with it and save reference you like.

to follow pawn from a distance, you can do hierarchy like this scene->springArm->Camera, and make this cameraBP to update it’s possition when your reference changes position.(this will also solve collision for you)
you can try handle all that yourself, but spring arm is probably easiest.

I roughly whip up 2 of those BP in about 15 mins where when start playing, once I hit P, the cameraBP in scene will start look at me no matter where I go.

for Divintize’s case(station nary camera), you can actually possess those camera BP, and have level blueprint’s trigger to instruct PC to possess another cameraBP.

I kinda of finished the classic RE camera switching in a temp project like I describe above.(around an hour to do interface/events/switch and corridor setup)
Although I’m a bit lazy so I need to use level blueprint to setup first camera pawn to possess.
All the rest pretty much implemented like I mentioned.

@rodstone, maybe it’s possible to handle first possess for playercontroller, but you kind of need to write it somewhere because PC is spawned upon start.
TriggerVolume can be assigned to each CameraPawn’s variable, so that part is easy.
If you just have one remote pawn and one camera pawn, you can do that on GameMode, so it spawns both and hook up things.

The things I’m not satisfied with is getting player controller needs a index, which is kinda fine for this type of single player game.
But I think there should be more elegant way of doing this.
I need to clean it up a bit tomorrow before I post a screen or maybe just the entire test project.
It’s something interesting to do quickly though.

Thanks for those posts guys. I’ve read them over and over and I’m still struggling with this. I don’t know how other parts of this engine seem very straightforward to me yet this isn’t.

This is what I have so far, I tried my best to do it like you guys suggested, but I kept wondering “how to do that” and yeah

So when level is begun, I call a macro function that spawns a new camera and returns that camera to me
I spawn my new vehicle and then call a function via an interface to set the camera target as the vehicle I have just spawned. The target I gave to the interface was the camera object I just spawned.

In my camera pawn, I have on event-tick a function that grabs the current targets location, and sets myself -1800,0,0 from it (which is basicaslly the view I want), then sets my world location to that.

So far it’s seeming more complicated than it needs to be, and it doesn’t even work? I have been trying to debug it and regardless I don’t even know if the camera I have spawned is the active camera and I don’t even know how to make it so

Ok, it seems that many people have problems with cameras. From my POV, using CameraComponents and Springarm, etc makes everything overly complicated, since you got to implement this per pawn.
The easy way would be to use a PlayerCameraManager Blueprint and assign that to the PlayerController. Per default you would use the controlled pawn’s location to calculate the camera position, but nothing stops you from using a different target.

As already the name “PlayerCameraManager” seems to scare people away, i did a very small sample blueprint thats in 500 units distance of the player, with a pitch of -20. If you want the camera to be farther away, just change the used value inside the blueprint (download: CamStuff.zip).

The only thing you got to do is to remove any cameracomponents you already have, and then assign this blueprint to the property “PlayerCameraManager” in the Defaults of the playercontroller.

Have fun,
Cheers,

Thanks I am definitely grabbing that right now.

Also, if you don’t want to automatically use the camera component, there is a check box to turn that off.
In your PC blueprint, default section, “PlayerController” => “Auto Manage Active Camera Target” check box does this.

I am feeling like a real ***** here but how do I communicate to that BPCamera?

I tried making an interface for cameras, but as of now I am not entirely sure if that is correct.

I really appreciate this help. I hope some day soon I “get” all of this because when I do I’ll feel very happy about this and can move onto the next stage

I’m cleanning up my test project. Will do a short demo video and zip the project later.

I feel like I am close to getting this one of indygoofs working but I am incredibly frustrated with how hard it is to communicate to the camera

I tried setting up an interface but that wasn’t working

So I tried using a macro. After all I made a macro for spawning my ships and it worked straight away and very easily and it meant my level blueprint could call the spawn function, hand over possesion and that’s ALL I have to put on any new level

Now I’ve tried to make a macro function called updatecamera or whatever but it keeps complaining that the BlueprintUpdateCamera function in indygoofs file shouldn’t be called from a blueprint? WTF??

Is that function meant to be called automatically?

Yes it seems it is, and I use Set View Target and some other things to access it? All of a sudden yes this is making sense! I haven’t got it working yet but I think I am getting much closer

Hey rodstone,

what exactly are you trying to “communicate” to the camera? Do you mean keypresses, or setting any variables from outside?

If you want to set any variables from your playercontroller, you can directly call GetPlayerCameraManager->cast to BPPlayerCamera->Set Variable … from your PC.
I.e., i updated the Blueprint to have a public var named “FollowActor”, if that var is set, it follows this actor instead of the controlled pawn (i updated CamStuff.zip too), so you could do this in your Playercontroller:

After re-reading the Camera documentation suddenly what you’ve done makes more sense and it definitely seems like it’s the way to be done.

I was trying to tell the CameraManager what target to follow, I didn’t realise it would automatically get that from a SetViewTarget command

Although I still haven’t got it working, I think I am close to understanding it.

This is the level blueprint. It spawns the ship (works well) and then I am trying to set the view target directly after but while it compiles and everything it just doesn’t seem to work

Is there something more or less that I have to do?

BTW thanks indygoof you are slowly helping me get over a MAJOR hurdle in making this thing work for me. :smiley:

e:
“The UpdateViewTarget function in PlayerCameraManager queries the ViewTarget and returns that ViewTarget’s Point Of View. This function is also what calls BlueprintUpdateCamera if you have subclassed APlayerCameraManager and are not looking through a CameraComponent.”

I don’t see the UpdateViewTarget function anywhere?

UpdateViewTarget is only available through C++ and not via Blueprint, thats why that special BlueprintUpdateCamera function exists.

Apart from that, what are you actually trying to achieve? You spawn your ship and posess it, ok so far. Why are you explicitely setting your Viewtarget afterwards? Since your playercontroller should already have the BPPlayerCamera Blueprint assigned, this one should handle following the ship already?