Download

How to pan camera in Top Down game with Blueprint?

Hello,
I am really new to Blueprint. I searched all over for this answer. I apologize if it has been posted somewhere and I didn’t see it. I am trying to figure out how to make the camera pan to follow the mouse in the Top Down template. The idea is for the camera to act the same way (for lack of a better term) as in traditional MOBA games. I wish to be able to pan the camera as the mouse reaches the edge of the screen. I assume that I would need to match the camera’s view with the cursors location. As for exactly how to do that, I am lost. I appreciate any help that can be provided. Thank you in advance!

i think someone said that the easiet way to handle the edge of screen case, is to add a gui to the game, and have invisible gui areas close to the window edge. add a mouse over to this component and move the camera based on what element it is.

I never thought about doing that. Makes sense why it would work. I was using the Top Down Template and I was able to print the location of the cursor to the screen as well as the character. I guess I thought that I was just missing something on being able to make the camera have the same location as the cursor in screen space. I don’t know if I am explaining that right. As for what you said with the GUI, I’ll give that a shot and reply if I could get it to work. Thanks for the help!

One step closer

I was able to determine if I was in the correct screen location but I am still lost on how to translate the camera based on the mouse location. I am checking the ViewPort size and checking to the current location of the mouse’s position. Everything registers like it should in the check. Just a little baffled about moving the camera now. Thanks in advance for any further help.

I did a tutorial for what you’re trying to do. Check out my blog, (link in the signature) and look for RTS Style Camera Movement with Edge Scrolling. I believe it’ll be a good starting point for you. It covers setting up the player and the HUD blueprints to get everything working. :slight_smile:

Great tutorial! Thanks for the help!