Right Click Camera Control and Alt Tab

My goal is to let player control the camera when right click is held down (similar to World of Warcraft) and when right click is released, mouse cursor will show. Everything works correctly until I alt tab, after that I can only move my camera abit because my mouse hits the edge of the viewport. Any ideas how to make refocus viewport and capture mouse properly after alt tabbing?

I tried:

  1. Set Focus to Game Viewport when right mouse button is pressed. It doesn’t seem to work.
  2. Set Input Mode Game And UI (Lock Always/Lock on Capture). I can no longer move my camera.

===================================================================

ThirdPersonCharacter has modified blueprint nodes categorized with blue highlight.
To reproduce:

  1. Run the project file
  2. Press play
  3. Hold right click to move camera, your camera should be able to rotate more than 360 degrees and will not get blocked by viewport’s edge.
  4. Alt tab
  5. Alt tab back to the game
  6. Hold right click to move camera again, your camera will stop when cursor hits the edge of viewport.

===========================================================

Download Project:

Hey SmileyJeff,

On your right mouse down you need to “set input mode game only” and the part you were missing was that the target MUST be the player controller.

Note you must also “set input mode game and ui” after you release the mouse or you wont be able to click on things once again after you get your mouse back.

Below is the screen shot:

Thank you, that worked flawlessly!