Download

Problems with GetMousePosition in Fullscreen mode.

By some reason on right and bottom borders of screen mouseposition returns (0,0), heres video:

eh, obs didnt capture cursor right ;(

ill try to recrod another video that exacly shows whut im talking about, left and bottom viewport side pixels returns x0,y0 position.

- YouTube heres video captured by geforce shadowplay and it captures cursor just correct.

AFAIK you get [0,0] if the mouse is outside the window. Else you will get between [1,1] and [ScreenWidth,ScreenHeight].

but it happens in fullscreen mode, how the hell i can get outside the window in the fullscreen? btw i get [0,0] at top-left corner like it suppost to be, u can c it at the video. I still pretty new to engine so mb i dont understand something fundamental about screen and mouseposition inside?

heres new video, this time i packed project and i got negative values on right and bottom, + they are like random once i got -622034123 on this video about on y -29, and 0 on x always,

I tested it on my old 4:3 monitor and everything works just correct, but not on my main 16:9 monitor

Can you post the code you are getting the mouse coords with?

float mouseposx, mouseposy;
controller->GetMousePosition(mouseposx, mouseposy);
GEngine->AddOnScreenDebugMessage(-1, 3.f, FColor::Cyan, FString("X: " + FString::FromInt(mouseposx) + " Y: " FString::FromInt(mouseposy)));

Yeah, I had the same problem a few months ago, the funny thing is that it worked perfectly when using the blueprint function instead of C++… that’s the only workaround I could find.

i need to get this done by code.

Then I’d be happy if you can share your solution if you find one because it would also be better for my project to do it from code :confused:

Just create new project and add this code to controller’s tick cause i had same problem globally on every project. Btw im using 4.20, not sure about previous versions.

Cmon guys, any ideas, i got this problem with windows10 and 4k 16:9 monitor, but not with 4:3 monitor, also it works well on my macbook air, any ideas why fullcreen isnt working right on windows with 16:9 monitor?

Ok, i found solution, problem was not in UE, but in Windows10 settings, i used 200% desktop scale and by some reason it ruined everything, i found it out when i tried to play StarCraft and i had exac same bug there, so i changed desktop scale to 100% and now everything works just fine.

That’s strange, I have the UE bug but never had any problem in SC2 :confused: I’ll test that when I have time.

Not SC2 but SC:Remastered.

This problem getting on a new level when u playing Fallout: New Vegas lol, you getting like offset to ur real mouse position, and this offset is going out of screenspace bounds, im so exited, i never thought default win10 functionality can f****s everything up so hard.