Camera movement on mouse click and drag

Hi everyone,

How should I make a camera move when a person right clicks and then drags on the screen, just like in the UE editor when you click the middle mouse and drag to change the camera location on the Z axis.