Get Mouse delta only reports if a key is down. Any way to constantly get the mouse delta?

image

Hey guys, I am trying to get the mouse delta with the GetMouseX/Y nodes. It only reports if I press one of the mouse keys at same time as I move it though.

My goal is to use the mouse speed as a multiplier for weapon sway. It seems like this should be the simplest way. Another option is that I can get the mouse position in screen space and compare it with itself on tick (vector subtract to get magnitude which would indicate speed, i think?), however I wonder if there is not a simpler way?

So this looks like an actual bug related to is you have the cursor shown in game, which I do as im using top down template.

if i hide the cursor then it works as expected.

hide the mouse cursor

1 Like

I’ve done that but I had to make a minor workaround. Because this is topdown game with UI on screen that I need to be able to click. However, it’s easy workaround.

I just get the location and when the cursor gets close to the UI, i can toggle cusror on and off.

This continues to be a problem…

If i have the cursor set to not visible, then the mouse delta reports but I cannot click any UI. Changing the SetShowMouse cursor bool and any of the input mode functions at runtime doesn’t change anything.

So I only have two options, use with the cursor enabled and find a work around for clicking UI, or disable the cursor and find workaround for mouse delta not reporting. I wish I knew what was causing the problem.

if what you need are deltas you can build your own delta mouse reading this and subtracting previous reading :slight_smile:

image

1 Like

try this

3 Likes

hey that works great! saved me a lot of time. i’m really slow with math stuff :slight_smile:
I made one change in that I think it may be best to use percentages, since the screen size may change. I think this way, the math would always be the same. And also if i know its always 0-1 range, then i can base the rest of my calculations from that (which is how i already had it setup before)


1 Like

I explained this bug here:

Hopefully the engine is some day updated to fix this.

2 Likes

thanks for sharing.

I had tried like constantly setting to game mode like that, but the problem is that I need both game and UI to be active because i have UI on screen to be clicked at any time (top down RTS style game).

Perhaps there is some work around, but I think for now, just doing a manual calculation for the mouse delta is probably the easiest thing.

1 Like