What exactly is target and new view target?

I am a total newbie to Unreal Engine, and I am trying to setup a camera similar to an RTS camera, where you look down from an angle, and you can move around with mouse or arrow keys. I found online this blueprint code to set my custom camera (just a pawn with a camera component) to be the default camera when the game starts

I have backgrounds in C++ but blueprint is totally new to me. What does the target and the new view target do and why do they get attached to those 2 nodes?. I have done some digging around and the new view target is both the camera and where the camera looks at(A clear definition of "View Target"? - Feedback & Requests - Epic Developer Community Forums)? It does not make sense. And then why would target be attached to the player controller, which according to documentation, is a brain that controls a pawn?

welcome @anonymous_user_eb4984a6 :slight_smile:

yes, Get View Target with Blend node is a bit confusing for a couple of reasons… It’s confusing because in GVTWB… (a) target has two entirely different meanings and (b) because one might expect it to reference a camera component (which it doesn’t directly, it references an actor)…

  • Target (the first one) is GENERALLY used in BP to identify the subject of the node. Like the Set Actor Location node, the Target is the actor that you are setting the location of. For GVTWB, you are setting the view target for a specific player as identified by her/his player controller.
  • New View Target (the second one) is used to identify an actor (not necessarily a camera, though it can be a camera actor) and it goes to the actor to identify an attached camera component.

Extra note: It can get a bit messy if you have more than one camera component attached to your actor, you may find you need to Enable/Disable cameras or use camera actors as child component actors… to ensure you GVTWB picks the specific camera you like… the techniques are well described here on the forum. GVTWB just isn’t super clear and logical like most BP nodes are at first glance, and it is unusually clumsy to use if there are multiple camera components attached to one actor but it does work well and consistently enough.

1 Like

@aNorthStar thank you for your answer. So am I correct to say that with GVTWB, then the game view that the plucked in player controller will see will be from the New View Target? In my case, since GetPlayerController isnt connected to anything, it defaults to the default player controller, and that is why this blueprint actually sets the default camera. Is my understanding correct?

The first Target is just used as a referencer, in this case to reference the player, forget totally about any cameras here: Get Player Controller will get tthe controller associated with the player index on it and the default index is player 0.

The View Target is used to reference the actor that contains the camera component, so here you are passing in an actor

Extra note: Just to confuse matters, UE4 seems to spawn in an extra camera at runtime… which is an issue you might be coming across

If you are still having issues, just post here and I’m sure we can get 'em fixed up

@aNorthStar, just to be clear, when you said “setting the view target f*or a specific player as identified by her/his player controller” you mean in a multiplayer context right? Because in single player there will only be one player.

yes, index 0 is used in single player as the default