I’m doing a product configurator and I’m in the final stage of the camera, I can already rotate it in 360, have zoom in and zoom out and now I need camera panning, the idea is: the user clicks with the middle mouse button and safe to drag the screen up and down or left and right, I tried with these blueprints but it didn’t work
Here is the code for panning the camera. The idea is to move the camera on its own axis, the nodes for that are “get actor up axis” to go up/down and “get actor right vector” to go left/right.
If you prefer the camera to move on a plane instead, we will replace these nodes by a simple vector (like 0; 0; 1 for vertical and 1; 0; 0 for horizontal (may also be -1; 0; 0 or 0; 1; 0 or 0; -1; 0 depending if your scene is facing north, west, south or east)).
There is an other method for a smooth movement (interpolation on tick), tell me if you prefer. In this case it would be good to see your code for the rotation and zooming of the camera, everything can be smoothed.
“Camera rotation yaw” is simply a group of collapsed nodes. It is possible to select a group of nodes, right click and choose “Collapse nodes”. It is simply to arrange the blueprint.
At least on my picture you can see that if middle mouse is pressed, it does something, if not, it rotates camera on yaw, that was the purpose.
You can’t get actor up, forward or right vector on the spring arm since it is a component (there are equivalent nodes for components, but that is not what we need here).
Here is another picture without the confusing collapsed nodes so you can see better what is plugged on the branch. I also got rid of the “camera ref” now that I know better what you have done. Now the target of the nodes are simply “self”.
For the panning everything is done to the actor itself (by the way I’m using a character actor), I’m not doing anything to the spring arm or the camera :
I don’t want to over complexify things with the smoothness of panning and zooming for the moment if you don’t need it, however it is very easy to add it to the rotation. Simply check “enable camera rotation lag” on the springarm :
You didn’t need to create new inputs, in fact they may interfere. You already have your “Turn” input for panning left/right and rotate camera yaw, and you have your “LookUp” input for panning up/down and camera pitch. It is just that my inputs had different names, hence the confusion.
Use the one you want, but use only one for mouse X and one for mouse Y.
Don’t forget also to set default value for the variable “speed” (more than 0, 1 or 2 is a good value to start with) and “IsPanning” to false (but it was probably already the case).
Then I see also some nodes you didn’t copy correctly :
It worked!!! Thank you very much, just one more question, the camera is rotating with any of the 3 mouse buttons (left, right and middle button), what makes it also rotate when I pan with middle button, how do I make it rotate with only one of the buttons and not the 3?
Weird, it should not rotate with middle mouse button pressed.
If I understand correctly, you want to pan with middle mouse and rotate with left or right pressed ?
Simply create another boolean with your input :