Is there a way to use the Advanced Input system to trigger on mouse movement (no button is pressed)? I can’t seem to figure out how to do that. I basically want to trigger within PlayerController wherever the mouse cursor is moved. How do I setup an Input Action and Input Mappings for that?
Once you add a new element to your input mapping context and assign it a new input action, you should be able to see a keyboard icon at the top of the settings when you expand the input action. Click on the dropdown box next to it, navigate to Mouse, and use either Mouse X axis, Mouse Y axis or Mouse X & Y axis. Hope this helps
Thanks. I figured out what I was doing wrong, but still don’t know how to do what I want. I have a visible mouse cursor and also have a First-person Pawn that moves around when I hold the Right Mouse button. With the Input configured to trigger on “Mouse XY 2D-Axis” the event triggers when I move the mouse while holding the right mouse button (thereby moving my Pawn), but I want it trigger when my mouse cursor moves (i.e. when I’m NOT holding right mouse button). Any thoughts on this?
You might be doing some extra steps. All you need to do is just splitting the blue struct pin of your input action node (you can also keep them as combined btw, depends on the objective) and plugging the X or Y axis (it seems like it shouldn’t be both for your specific task) into the Add Movement Input node. Also check your input action’s type, I think you’ll want it to be 2D vector as well.
Thanks. But my issue is not getting the coordinates, it’s that the input event doesn’t trigger unless the right mouse button is held. I need it to trigger anytime the mouse cursor moves.
I think I know what’s going on. You have show mouse cursor enabled, right? You can’t have both functionalities at the same time. You should either:
Keep showing the mouse cursor and add a logic to your code without using input actions that detects the cursor movement and returns your desired inputs accordingly
Hide the mouse cursor and add a dynamic widget that acts like the cursor according to the momentary changes of the mouse x & y values
I won’t be able to guide you further on the details of the implementation since either of these options are not that straightforward, but these are your options to achieve your objective.
Thanks lot. I think that’s my issue. I guess I’ll add my own code to detect mouse movement. I just thought that this would already be supported somehow.