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"

Wrong GetMousePos when select UIOnly/GameAndUI input mode

So, the problem is that, if I set FInputModeGameAndUI or FInputModeUIOnly (with lock mouse to viewport and bShowMouseCursor enabled), and then if I move the mouse to left or top sides of window, then I will get mouse position == FIntPoint(-1, -1), as if i had left the viewport, but my cursor is still in the window boundaries, and this is the problem.

How to reproduce:

  1. Set InputMode like this:

    FInputModeGameAndUI Mode;

  2. Set bShowMouseCursor = true; in the PlayerController

  3. Write somewhere in tick function (for debug current mouse position):

    FIntPoint MousePos;
    UE_LOG(LogTemp, Warning, TEXT("Current mouse pos: %d %d"), MousePos.X, MousePos.Y);

  4. Launch game

  5. Move the mouse cursor to the leftmost or uppermost position.

  6. When you reach left or top side of window you will get in log: Current mouse pos: -1 -1

So, I think that Viewport wrongly think that mouse left the window, because the same mouse position (-1, -1) you will get if mouse cursor is really left the window.

Another things I noticed:

  • When mouse is captured by viewport (Viewport->HasMouseCapture() == true) then all is work properly (GetMousePos return FIntPoint(0,X) if touches top side, or FIntPoint(Y,0) if touched left side), but in this case viewport widgets can't get any input information (that what I really need).

  • All work fine in FInputModeGameOnly (because it sets viewport capture), but it is not a solve because i still need input for my viewport widgets.

Maybe it's a bug or I'm doing something wrong, hope somebody can help me.


  • The problem does not exist in an standalone game.

  • If you change size of your PIE viewport and hit in some magic numbers, then the problem disappeared, too.

So, i think it is definitely a bug of PIE viewport.

Product Version: UE 4.18
more ▼

asked Feb 09 '18 at 02:00 PM in C++ Programming

avatar image

21 4 6

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

0 answers: sort voted first
Be the first one to answer this question
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