Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to get active Camera object?

How to get an object of current (active) camera? Maybe is there something like Get Player Pawn, but for camera? I know that i can get a camera component e.g. from my player character, but what if current camera view would be e.g. from some security camera? That's why I'm searching for something like "Get Active Camera"...

Product Version: UE 4.9
more ▼

asked Sep 13 '15 at 03:33 AM in Blueprint Scripting

avatar image

2k 154 153 206

avatar image ambhar Sep 13 '15 at 10:14 AM

You can store your active camera using a variable of type Camera Actor and use this variable later to get access to your active camera.

avatar image Slavq Sep 13 '15 at 11:02 AM

Yeah, but i'm looking for "universal" solution for other users, as i'm making a future marketplace item - so no matter what camera user have and how it was set up, it would detect it, without need to setting variables... But i see that there is no node like that, so probably I'll put it into a variable and tell user to save his camera into this var :P Thanks for the tip though, +1

(comments are locked)
10|2000 characters needed characters left

4 answers: sort voted first

I found this thread while looking for a solution to my problem, but solved it in a different way, so I'm tossing this up here in case it helps anyone in the future.

There is a node called Get Player Camera Manager, which returns a Camera Manager reference. This allows you to get and set certain values of the Active Camera tied to the Player Index, regardless of whether or not the Active Camera is part of the player referenced.

For example; I have a camera which is in the world, and was able to get it's location using this node. I'm sure you can use this node for much more than that though.

more ▼

answered Feb 27 '18 at 03:29 AM

avatar image

26 2 2

(comments are locked)
10|2000 characters needed characters left

You might have to write a wrapper function yourself

 // Look for the first active camera component and use that for the view
 TInlineComponentArray<UCameraComponent*> Cameras;
 GetComponents<UCameraComponent>(/*out*/ Cameras);
 for (UCameraComponent* CameraComponent : Cameras)
     if (CameraComponent->bIsActive)
         CameraComponent->GetCameraView(DeltaTime, OutResult);

I found this in Actor.h under CalcCamera function. You can use this help to write your wrapper function

more ▼

answered Aug 17 '16 at 12:29 AM

avatar image

48 5 8 20

(comments are locked)
10|2000 characters needed characters left

Camera system in UE4 is actor based, you say what actor is viewed called view target and camera menager asks view target (actor, by calling CalcCamera) about camera position, so actor decides on camera position. By default actor search camera component in itself and sends position of first one it finds, so camera component is quite dummy. Each playercontroller has camera mangager and it means each had its own view target. So theres "Get view target" node which let you get current view target actor, from there you can get camera component, but actor should be the one should operate it.

more ▼

answered Sep 13 '15 at 02:41 PM

avatar image

35.7k 925 168 1101

avatar image Slavq Sep 15 '15 at 11:34 AM

Thanks, so now I have Get Player Controller ---> Get View Target, but there is no "Get Camera Component", only "Add Camera Component". Am I missing something? I've also tried Get Components by Class (CameraComponent) and getting the first one (index 0), but it doesn't find anything.

(comments are locked)
10|2000 characters needed characters left

My solutions in BP was to get all actors of class, the camera blueprints that is, loop through them with a ForEachLoop, checking each one with isActive = true. So if i had 4 camera blueprints in a level i could locate the one that was active

more ▼

answered Sep 07 '16 at 01:02 PM

avatar image

18 2 4 8

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question