Panning camera using blueprint

I’m currently trying to pan a camera in the side scroller template, but so far with no luck. I’ve managed to it to detect when it reaches the edge of the screen using a blueprint from another thread here. I have not managed to find anything that tells me how to pan the camera once I move to the edge of the screen. I’m looking for something like the League of Legends unlocked camera, but usable in the side scroller template. If anyone could provide me with an explanation or even just a screenshot of how to continue what I currently have to get it working, that would be great. Thanks in advance.

That looks quite good. Now let’s think how this could work.

You need a way to determine where the camera should move. You get a boolean out of your setup however you don’t really want to check with branches if you are overlapping two of those at once (I assume you don’t want straight up, down, left right movement but also diagonal).

I do this by creating a temp vector which I set each frame by +1 or -1 in X or Y depending on which branch triggers.

The result gets fed into a function inside of my character.

Inside of that character I have the camera attached to a spring arm and then move around the spring arm in this function. That’s pretty straight forward. It looks like this:

I hope this helps :slight_smile:

Cheers

I’ll try that out later and see how it works. I’ll probably do it tomorrow morning, so I’ll let you know then. Thanks for the suggestion!

Would you mind posting pics of the rest of that BP? I set up what you’ve shown me, but it isn’t doing anything right now.

If you’ve set it up like I did, did you remember to set the speed?

Do you have the camera placed as child of the spring arm? (one level lower in the hierarchy tree… I lost how it’s called :S)

Because I don’t really have anything else in the bp…

Well I do but nothing regarding the unlocked camera.

whats the name of the speed variable again? and what do you have it set to?

Well in my case it’s just a static variable which I set in the controller and in the function I directly input it into the Vinterp to constant.

In the controller class you can see it at the right just before calling the function inside of my character.

I think my problem might be my camera. It doesn’t seem to be doing anything

Could you post a picture of your movement and the components tab?

That would make things easier than to guess every possible thing you or I have overlooked :slight_smile:

I’m like 100% sure I have my components are the problem

You have to create a character or a separate Camera which you add to your character.

The controller does not have a location and all that stuff.

Sorry, I’m still kind of new with UE4. Would you mind showing me what your components tab looks like?

Pretty much the same. That’s not the issue.

The issue is the parent BP.

You need a BP with the parent “Pawn” or “Character”. Not Controller.

You will have to create a new BP for the camera usually being the same as your main character (be it a character or vehicle or something completely different).

Ok I’ll try that

If I could just ask you another question. What is the view movement margin? what is it supposed to be set to?

In my example it is representing the margin at the border of the screen in which the camera will move in percent (because I’m doing the percent calculation in that percent node).

A good value for testing was 5. For the actual game I keep it around 1-3.

ok. And another thing. Would this work if I put all of it into a pawn blueprint? or do I have to put it into a controller and a pawn?

You can definitely do everything in the pawn.

I just split this functionality because I like to keep everything input / responsiveness related stuff in the controller and only keep directly character related stuff inside of that one.

But that is merely a thing of how you want to structure your BPs :wink:

Ok I have it working now. Only 1 issues though. When I go to the bottom of the screen it doesnt move.

Well then there has to be something wrong with either the way you use the resulting boolean or with your calculation before that.