UNREAL 4 - How to select a character and focus to rotate using its camera?

Hi, im using a character RTS Camera, and i wonder how can i select a character from my scene, and press F to Focus to that character, so i useit´s camera to rotate around, like watching it, then press F again and retunr to my RTS Camera, i haven´t found any video tutorials for this at YouTube, i have only found character possesion, but at least in my case it doesn´t work between characters, only between pawns (at first i thought it would becasue a character is a kind of pawn, but it didn´t work).

F´m still learning, if you know a good video tutorial or know the exact steps. please share.


Your accually asking for 3 seperate things:
1.Select the character
2.Focus to that character
3:Have all the stuff you want todo in focus mode.

There was a great RTS tutorial on step one a few years ago, but I can’t find it sorry.

  1. You need todo a raycast from the mouse cursor and then use collisions to search for the actor. If the cursor hits an actor you want to focus on you select that character.(Just store the actor in an array)[whenever you select a new actor clear the array first then add the new actor to that array] (It sounds like this is your problem)

  2. You need to go to project settings and define F as the focus key. Then in your player controller whenever you press F you then need to switch your possession to the pawn. If you already posses the pawn then pressing F simply transfers you back to your orignal pawn(which btw you will probably want to store on your player controller) [Note use an if statement if this current pawn == to the orignal pawn then switch to selected pawn otherwise switch to original pawn]

  3. You add a camera to the pawn(have it facing towards said pawns body using a spring arm) and allow yourself to rotate the camera round the pawn using the Mouse x and Y. However if you want you could instead just control said pawn and play him like an 3rd Person or 1st Person FPS, but you would need to define those actions in the pawn itself.

PS: Characters are pawns, but with more stuff added.

Thanks a lot man, i really apreciate your help

I´m more interested in step 1 and 2, but apllied to a character BP, I already created my hit resoult for my RTS camera BP (see image below/ right now it shows hello on screen when i select any object), could you please upload some BP for focus and possesion of a character´s camera (not controllers, just camera rotation) like “if character has camera, you can focus, if character doesnt have camera you can´t focus”, i belive after hit result there is where i need to add the focus nodes and possesion, already tested possession but for some reason it doesnt´work with my character, only Works with pawns, an error message says “this blueprint(self) is not a controller, therefor must have a connection” (see error below).

please help