Best practice for Free Roam Camera in mouse click movement gameplay?

New to UE and programming in general so my logic of how things should be or might ought to be is likely off… but with that said…

My plan is to have WASD or Mouse movement to edge of screen transition to a secondary camera and upon clicking it transitions back to the player as they’re moving. My initial thought was to possess a FreeRoam camera actor and have the location input transferred to an AI controller taking over my player, but I’ve hit roadblocks after roadblocks trying to implement something like this.

Was wondering if there was a better method than trying to coordinate AI to listen to PlayerController when I haven’t even been able to get it to successfully possess my character yet.

Any input would be helpful. Tried looking up this online or in the forums but it was always simple ways to set up AI to do x y and z to your character without your character itself being the target of possession or control after you’ve unpossessed.

Certainly could be working on other things instead of bashing my head against this but for whatever reason common sense of not getting bottlenecked by a problem just doesn’t factor in with my brain, so this is my attempt at trying to get outside knowledge to break a bottle or two.

Thanks in advance for any input.

You’ve mentioned quite a few things in this post, making it hard to discern what the exact problem is. To get the best help you’d need to define a very clear checklist of features that you need, and then what problem is preventing you from achieving them.

I can point you to this short overview of a topdown camera here:
Beginner Micro tutorial : Simple Top down camera with screen edge panning, two aim styles - Programming & Scripting / Blueprint - Unreal Engine Forums

If you have any specific questions feel free to ask.

Have you ever played mount and blade warband/bannerlord?

The goal is to have a camera that can move independently of the player but upon clicking (to move the character) have the free roam camera transition back to the player.

My initial thoughts were that I would have to possess a free roam camera actor and then send commands to an AI to move the character, but I’m not sure if this is logically the best route or if I’m complicating something needlessly.

For an easy example:

He looks for a city away from his character, clicks it or nearby it and the camera transitions back to the player and follows it. I feel as though I’m over complicating this the more I try to describe it lol.

I might be able to piece together what I’m looking for with that link though, if so I’ll re-post and let this rest. Thanks for the input.

i’m familiar with that game and the camera.

i think your idea is fine, I’ve seen an example of that in a youtube tutorial. I am pretty sure it was this series:
1.1 Camera Setup [UE4 - RTS Tutorial] - YouTube

IIRC, the basic idea was similar to what you described in that the camera is actually a pawn, and what the player understands to be their character is indeed an AI actor that takes directions from mouse clicks.

If you are going to be controlling multiple units I think that is probably the better approach. If you only ever have one unit under your command, I think a simpler method like I described might be appropriate.

If you did something like I described in the tutorial, you could just call the camera reset event when clicking to move. This is the same functionality I have in my project at the moment. Actually, come to think of it, I think it is pretty much exactly like the overworld view camera in M&B.

Keep in mind I am not a professional, I am a beginner just figuring things out as I go to. So don’t put too much faith in my solution - but it may give some ideas at the very least.

I’ll give both a shot, thanks for the input.

I wish I wasn’t boneheadidly stubborn when I reach a stumbling block so I could work on other things but I’ve been trying to brute force this problem for over a week now and getting antsy about lack of progress. Hence reaching out :P.

I’ll have to brush up on my google-fu for future problems just couldn’t find the adequate wording to explain the problem to find reference material to work with. Thanks for the help!

1 Like

no problem - it took some digging to find some examples myself so i’m happy to share some links and whatnot so its a little easier for anybody else in future to get some ideas