Download

Setting up a Camera for a Topdown-Moba-Game

Hello,

after hours of research and lots of experiments I thought it might be the next step to ask for some help. First of all I have to admit that I’m new to Unreal Engine 4. I come from a designing background and lack in programming skills (XP: some java, some js, webprogramming [angular, ionic, typescript, css] on a average skill level). The Blueprints visual scripting is something that convinced me to try out new things.

What do I want to do?
I set small goals and try not to think too big. I want to create a small topdown game where you are able to move around a map. Sounds pretty easy, pretty straight forward. I got some problems trying out to have a camera comparable to MOBA Games (Screen moves, when I the mouse touches the edge, Character moves on click) . My research lead me to RTS Cams and severeal different ways to aproach that topic. Without success really.

My idea to get it done:

  1. I figured out that the springarm and the camera are a child to the character static mesh. They are connected - so wherever my character moves the camera moves.

  2. I realized, that for my solution the character and my camera have to be two different actors. The character should be move when I mouseclick somewhere. The camera actor should move, when I come close to the edge of the screen. I kind of figured out how I can check the cursor position and a printed a string when I came close to the edge. My problem seems to be more basic. I could really figure out how to set it up.

  3. Is my aproach correct or is there a easier and more efficient way? Do I need a new GameMode? Do I have to setup more / different Controller?

I know that my question is quite basic and there is probable a very easy way to solve it. I’m sorry that my research skills aren’t better. I hope somebody was thinking about a similar issue and found out a straight forward aproach. I kind of need to get some information about the basic structure. If I got that I will find tutorials to make it work. Thanks to everybody that took the effort to read all this! I’m very grateful for every reply and tip!

You are still using the default camera and the default camera is set to center on the player. What you need to do is create an actual camera system in blueprints or C++ to allow far more control over the camera it’s self. There are as many ways to do that as you can imagine really. The basic idea though should be a camera that knows where it is in world space and where the player is. You basically want to make a bounding box area the camera is allowed to move freely in but also a second set of bounds that will act as a trigger. If a player enters the second bounding box then the camera is allowed to snap to that player and follow it. If the players goes beyond the distance the camera can travel the camera will simply collide with the bounds and stop moving. It allows the character to walk out of center when coming to a wall. If you have more than one camera in the scene and a player can cross over from one camera bounding box to another you can transition the hand off from one cam to the next and the transition can have any blend time you want to make the transition slow or fast etc.

Have a look at this tutorial https://www.youtube.com/watch?v=MfF8J9ZyvTM&list=PLqMRQDtD3Wtw_oEi1bC8NQV-r9YMTzLmg It will explain how all of this works and walk you right through creating it. You can easily apply this camera system to many different game types not just side scrollers but if you follow the tutorial maybe you should use the side scroller template that he uses and build it once and test it a bunch till you understand it. You can probably migrate the camera system you make right over to your current project once you have the hang of how it works too.

If you end up using that camera system make sure to give a shout out to JvtheWanderer: User Profile - Unreal Engine Forums He saved so many of us so much time and effort.