Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problem with mouse input

What can cause mouse-axis input to be captured(?) only while a mouse button is being pressed?

I've ignored this problem for some time, but it needs fixing now. I am controlling a character in 3rd person and it only rotates or looks up/down with mouse movement, while I'm pressing any of the mouse buttons, which is rather absurd...

I noticed there is a setting for this kind of thing under project->input, but it's set to capture permanently. Maybe my GUI-wigets are absorbing input until the focus is forced to the game-view by clicking (holding) on it, but I really don't know.

Product Version: UE 4.14
more ▼

asked Feb 28 '17 at 02:00 PM in Using UE4

avatar image

643 65 80 116

avatar image Drunkenvalley Feb 28 '17 at 02:05 PM

Are you doing anything with the mousebuttons in your code/blueprints?

avatar image MaxPower42 Feb 28 '17 at 02:17 PM

LMB is for shooting, the others don't do anything atm. I am pretty sure, only the pawn/character has bound actions for them.

I monitored the values passed to the mouse-axis input functions (from the character). They are always zero until a button is being held.

edit: I also removed the widgets completely, but it's still the same.

avatar image MaxPower42 Feb 28 '17 at 02:41 PM

I probably should have mentioned I am using a "GUI and Game" control mode for the player controller. Maybe it's always like that for that mode? I think I may have to use "Game only" for permanent mouse capture...

avatar image SvinSimpe Feb 28 '17 at 03:06 PM

Could you pass an image of your input settings? Axis mappings and Viewport properties..

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Thanks for replies, but I think I figured it out.

Looks like this behavior is normal when setting an input mode for a player controller of type FInputModeGameAndUI. I thought I could use that mode throughout and switch between direct controls and GUI by toggling cursor-visibility. But I guess I have to toggle the input mode instead from FInputModeGameOnly, where mouse capture is permanent, to one of the two others.

more ▼

answered Mar 01 '17 at 08:38 AM

avatar image

643 65 80 116

avatar image AlexCheero Nov 25 '17 at 02:28 PM

i have the same problem, but your solution didnt work for me. where you set this input mode? also where you store the input mode variable? for example i tried to set it in players controller constructor, using SetInputMode(InputMode); where InputMode is controller's field of type FInputModeGameOnly. because i afraid that if i use SetInputMode(FInputModeGameOnly()); that input mode variable would be allocated on stack and will be destroyed after constructor completes. but i'm not sure about this

avatar image MaxPower42 Nov 26 '17 at 12:38 AM

It's been half a year and I don't really remember what the problem was ^^ Looking at my code however, it turns out I'm still using "GameAndUI" after all.

I'm setting the mode in PC::BeginPlay like this:

 FInputModeGameAndUI mode;

I manually control inside axis input functions whether I want to pass the mouse input to the controller (PC::AddYaw/PitchInput) or not, and I simply toggle cursor visibility to switch between modes. During freelook mode (cursor hidden), I keep resetting the cursor to the center of the viewport. I think this was necessary to prevent the cursor from eventually getting blocked by the edges of the screen, so you suddenly weren't able to turn any further, and probably also to prevent clicking outside the game window. It's possible there are better ways of dealing with this, but it works for me and allows for flawless freecam and cursor behavior, both in fullscreen and windowed.

edit: the input mode variable (structure) doesn't need storing. I haven't checked, but I'm sure "SetInputMode" will copy or extract the data it needs for the PC class.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I used "set input mode Game only",and sloved the same problem. Have you try this?

more ▼

answered Dec 16 '17 at 09:57 AM

avatar image

11 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question