Download

Camera Panning help

Hello there. I just started learning Unreal Engine and I’m currently working on a personal project. It’s kinda of a RTS type of game but only a simple RTS like with some cubes and spheres. I need some advise about the camera panning. I have managed to do a rotate and zoom of the camera with the help of some tutorials here and on Youtube, but I am having issues with the panning.

The issues I’m having is that the panning works when I move the mouse to the top, bottom, left and right side of the screen, however, the moment I rotate and I start to pan, the panning gets inverted. Like if I rotate 360 degrees and I start to move the mouse on top of the screen, the camera will start to pan on the opposite direction.

I have read on the forums that I should use something like add relative rotation but I am really clueless about it. How can I accomplish this? Thank you very much in advance. I have attached a snippet of my blueprint.

I’m not sure how you have set up the actor containing the camera or the functions for moving it. But if you are trying to move it along (0, -1, 0) & (1, 0, 0), try instead passing in the actor right vector and forward vector as inputs for Mouse Movement. Basically, in order to account for rotation, we need to make sure that the current forward and right directions are being fed into movement instead of the default x & y axis.

Hello! Thank you for your reply. I’m a bit confused regarding the rotation part. Does this mean that I need to grab a reference of the camera and then use GetForwardVector() and GetRightVector() and then plug it in to the movement?

I meant that when your rotation is changed, the pawn’s forward and right directions are also changed from the default x-axis and y-axis. So instead of setting fixed values like (1, 0, 0) for your Mouse Move function, try passing in the Get Actor Forward Vector and Get Actor Right Vector nodes to its Axis parameter.

1 Like

Ohhh. That did it! Thank you very much!

1 Like