Making a top down RPG, however I want the camera to be separate from the player character however it must follow at its height looking down with the player character at its center. Also when the edge of its view hits the edge of the map it needs to be blocked from proceeding in that direction but follow any other non blocked direction, also needs to recenter the player character in its view once they have moved away from the edge of the map. Still rather new, can’t find any tutorials to help and I have no idea where to start.
How do I make a top down camera that follows player at a fixed height, however it stops moving in certain directions when its view hits the edge of the map?
There are a number of ways to solve this problem. The easiest is to extend the map beyond the reachable area. Then the camera can simply continue to follow the character without a problem, but it won’t be showing empty nothingness because you’ve extended the map.
Another way to do it, which I once used in a side scroller to keep the camera in the middle even if the character went up or down on the level, was to take the camera out of the character blueprint. Set it up separately. I had it readjust to the characters X position using the event tick, but locked it’s Z position.
You could do something like this as well. Separate the camera from the character (put it in its own blueprint) and have it follow the character around, but set its limits in the world. i.e. it can follow on top of the character until it reaches -10,000 X position then it stays at -10,000. It shouldn’t be too hard to work out that logic in the blueprint.
Good luck (a year later)
Hi! Did you manage to solve this? I got the same question but with the walls bounds in a top down game, so I need the camera to not moving forward when the player gets close to the walls.