Camera Pan In Game

I am making a program similar to sketchfab, and I was actually really happy that I figured out how to do the camera locking and mouse wheel zoom on my own from scratch. But I can’t quite figure out how to do the camera pan. I assume its adjusting the location of the the capsule I have as the parent to my spring arm and camera.

All I could get was the camera moved a set distance on 1 axis when I clicked the right mouse button and it would just keep adding to that over and over. Then I got it where I held right click and it basically shot off super fast, but still only on that 1 axis.

Any help would be great.


I don’t have access to UE4 right now so I can only describe how I would approach it:

You need to find a vector for “left” or “right” from the camera’s perspective (instead of a global axis), and then move the parent capsule in that direction (you can do this in the tick function and use deltatime as a multiplier to make sure that you only move an appropriate amount for the framerate). To find a vector for right and left I believe there is even a blueprint function “get left vector” / “get right vector”, or something like that. Use the camera actor as the source for that function.

Thank you! I got it working and moving at least in the right direction. I currently only have it working with the arrow keys and not the drag yet. But I will attempt that tomorrow with event tick. Thanks again

Also, I learned before this, it isn’t uncommon to “Flip” Something by multiplying by a negative number. I had to flip a model hand once and learned to just type -1 in scale and it worked. Although obvious, it is something new for someone that typically has a mirror or flip function in the program.

I can’t quite figure out how to get the pan to work correctly. These are all working right, but I have to keep hitting the button every time. I want to pan with the middle mouse button dragging though, not pushing the arrow keys. I feel like I am close…

Still stumped… I got something closer with event tick, but I can only have one… and it sounds like I want to avoid them as much as possible?

Bump? Please.

Sorry to necro this post, but for those like me where google returning this post, i decided to add what worked for me.

In my event graph I add an input check for toggling isRotating and isPanning flags.
With EventTick, I then call the update functions I created if their respective flags are on.

This let’s me continuously rotate or pan when buttons are down.

1 Like