Download

Beginner help: Multiplayer camera follow an AI character

I’m a beginner when it comes to UE and I’ve just been tinkering around with the engine to see what I can do. I’ve followed a few tutorials and now I am trying to branch out and do my own thing. Right now I am trying to set up a multiplayer point and click movement system. The basics work well enough but now I am trying to get my camera to follow a controlled AI character and having some trouble.

Currently I am able to control the camera with WASD and the character with mouse clicks as shown in the following video.

I’ve accomplished this by using a character and AI controller. The player controller selects the spawned AI character (mannequin for the client) and then gets the AI controller for it and calls a custom event in the AI controller. (This started as an RTS experiment but now I am taking it in a different direction)

To get the camera to move around I made a character blueprint with the standard 3rd person controls and made it the default pawn class. This all works pretty well but now I want to set it up so that the camera can either move freely or can be set to follow the controlled AI character.

I tried setting up a separate AI controller for the camera but I am not sure how to get a reference to the default pawn in the player controller.

I also tried passing the location of the controlled AI character to the camera but I am not sure how to expose variables across blueprints.

The easiest solution would seem to be exposing the location of the AI character to be used in the camera character class but I am not familiar enough with this blueprint system to understand how to do that.

Any advice would be helpful. I don’t even know if I am approaching this problem correctly. If I need to provide more details please ask.