Fixed! UE-28811 Get mouse X/ Get mouse Y returns zero after the user clicks the screen and mouse is shown
Fixed! UE-29148 Using “Show Mouse Cursor” breaks mouse axis movement
These appear to still be broken.
There is no method using blueprints to access Mouse X/Y values that work under the following conditions (4.11 project and 4.11.2 empty project):
Mouse Cursor is set to shown on PlayerController
Any Mouse Button has been released once already (mouse wheel x/y N/A)
No mouse button is currently in pressed state (mouse 4/5+ included)
The following all return 0 under the above conditions on both PlayerController (consume input disabled) and a possesed spectator pawn (input enabled):
My testing has shown this bug to be centered around the Project Settings → Input variable named “Default Viewport Mouse Capture Mode”. The two capture Permanently options are providing the wrong capture. Capture during MouseDown and RightMouseDown is working as intended. However all modes process mouse input until first mouse up event. During this time, the cursor is bound to the game window.
In addition, setting “Consume Input” to false on mouse axis events does not work correctly, the event will fire on a controlled pawn but the value of the axis will be 0 (in addition to the above issue).
Further testing shows:
-Setting InputModeGameOnly will reset Mouse values to a state similar to first run (ie. before first MouseUp event)
-Setting InputMode to either UI enabled option acts like the MouseUp event does in terms of causing a mouse 0 state, and was also extremely buggy in my test case.
As a related issue. 4.10 projects converted to 4.11 show inconsistent mouse behaviour seperate to this issue. (Notably relating to double clicks). This appears to be routed in the same ViewportCaptureMode from above, as this was added to 4.11 as a new feature as part of the HUD class rework (to my understanding).
I have a Test4.11Project if anyone wants to verify to see if there is an error somewhere.
+1, I’m still seeing mouse capture issues in 4.11.2 too. Thanks to Nodrak for the detailed writeup.
My game switches between InputModeGameAndUI (strategic mode) and InputModeGameOnly (third-person mode) by player input. Unless I hide my mouse cursor for the strategic mode (not what I want) then any mouse action that requires delta mouse coordinates (drag-to-pan/drag-to-rotate-view/etc) doesn’t work.
Hopefully there’s a third hotfix lined up, this is a pretty serious issue for games with strategy style controls. Also if anyone knows any workaround (code or BP) that’d be great to know!
InputAxis tied to mouse X/Y return a 0 axis value unless the mouse cursor is hidden.
The mouse locks to the viewport when Show Mouse Cursor is set to false then back to true. ‘Set Input Mode Game and UI’ must be called after showing the cursor to fix this.
Setting Show Mouse Cursor to true after being false requires a click before mouse clicks register if ‘Set Input Mode Game and UI’ is not called.
The mouse does not redraw when Show Mouse Cursor is set till true until the mouse is moved.
Here is an example of how I have worked around the 0 Axis Value issue, but have to hide the cursor and recall set input mode. The cursor does not show up again until the mouse is moved.
I have tested this issue again using 4.11.2 and it appears that you are correct. I have updated the report (UE-28811) and I have submitted this information for further consideration. I will provide updates with any pertinent information as it becomes available. As for the issue UE-29148, I ran through the test case for this issue and while the issues are similar it appears to be resolved. Thank you for your time and information.
I found a workaround today - passing “HideCursorDuringCapture” as “false” to SetInputModeGameAndUI fixes my capture issues.
However, this was tested with only my simple usecase of switching between GameModeAndUI (with mouse shown) and GameModeOnly (no mouse) so it may or may not work for more complex usecases (like the scenarios Nodrak listed).
Still thought I’d post it in case it helps someone.
The issue UE-28811 as mentioned above was updated and the status has not been updated to fixed as of yet. I will be sure to bump up the community interest on the report for this issue. However, as for the issue UE-29148, I ran through the test case for this issue and while the issues are similar it appears to be resolved. I hope that this information helps.