How to center the camera on a selected player ?


I would like to create a list with the names of all the players in the game, displayed on the screen. And when i click on a name, my camera needs center on the selected player.

Any ideas how to do that ?

Thank you.

Have you tried using the SetViewTargetWithBlend node? how different is the result that you want?

I just tried, but after using it , i can’t move my camera anymore. Also my camera view is dragged to the bottom of the target, but i need the camera to stay in top view.

hi, this simple example allows me to jump between pawn cameras using a widget with a button, how much different is this from your goal? (on your project you would have to access the other actors with GameState’s PlayerArray and then work with the PlayerState of that player.

slightly more elaborated example.

Nice, it work but i still have the 2 problems i mentionned earlier. I have a RTS-like camera, and when i press the button my camera is dragged close to the object ( i want it to stay in top view, just being centered on the object), also after press the button i can’t move my camera anymore wtih the edge scrolling.

i guess this really depends on how you are scripting your camera. you are not moving the camera to a player, you are “possessing” a camera, so if the new camera has no logic, it wont move as your main does. same with the position. just get the offset before switching targets and pass the offset to the new camera, reposition before the blend (you already has the reference).

Thank you, i make this work with a set actor location.