Why is mouse position always (0,0)?

When I call GetMousePosition on the player controller, the return value is always 0,0. This is happening on a Windows 11 PC running UE 4.26. I don’t see anyone else experiencing this online so I’m asking here: what could be the cause of this?

Hi @zReticulan !
yes because it points always to 0.0, perhaps what you want is the camera!

is a bit more tricky than calling that node to get the position.

you can watch this video that should explain a lot of stuff. basically you are asking for the mouse position in the wrong place. the mouse is sending the x and y position to the UI not to the game

1 Like

Yeah but then the cursor is active and not the game!
Unless we want that of course

if you ask for the mouse position from the correct input mode it will send it. mouse cares about the ui or about the game or both if I recall correctly.

ok the other one I think is:

1 Like

good try @dorusoftware

That’s not quite what I mean. The Return Value of the Get Mouse Position node is always false.

It will be always 0 because is always pointing 0, what you are moving in game is the camera

If you want to show the cursor and get position:

If you want the camera coordinates:

And perhaps a screenshot of how it looks the project will help us to help you…
Are you creating a first person, third person…?
what do you want to do with cursor position…

This project uses a custom game mode. It’s not first or third person. The mouse cursor is visible when I move it around the game viewport, but Get Mouse Position still returns false.

so you are moving the cursor like in windows, not like in call of duty:

That’s right. In addition, when I load the same project with all files being identical, the GetMousePosition node works as expected, and the proper coordinates of the mouse cursor are printed.

I figured it out. It turns out the computer, which I was connecting to via TeamViewer, didn’t have a mouse connected.

that is a big piece of information you left out from your question. That you are using unreal using a remote computer.

lol

2 Likes

I do it so often I didn’t even consider it would be the cause :laughing: but now I know Unreal needs a mouse physically connected even if the cursor is being moved around without it