How can I have an event work for only a specific mouse button?

I have made this system that allows me to rotate an object by clicking, and dragging the mouse, however this works for both mouse buttons.

What I would like to accomplish is having this only run when the right mouse button is down, and not when the left one is as I want the left mouse button to do something else.

I’ve tried many things but can’t seem to figure it out.

Any ideas?

The screenshot you’ve provided doesn’t show which inputs trigger that variable named “drag” of yours, so we can’t tell what should be fixed in your code. Aren’t you using input actions though? You can just create a new input action and bind it to the right mouse button.

You can place an input event for the desired mouse button in your BP, you can either assemble the functionality there or call another event and place it on the execution chain. Based off your screenshot, your probably wanting to place a “mouse left” event, and have it change the value of the drag boolean. Hard to say tho without some further explanation on what your trying to do exactly

The “Drag” boolean doesnt have anything to do with mouse input its just called that by coincidence. It is set by interacting with a pillar that the rotated object is placed on, it could be called anything.

Also Im pretty sure I dont have any actual mouse events, just ShowMouseCursor and the stuff in the screenshots that has to do with my mouse.

I see. Then you’ll need to add an input action that’s binded to the right mouse button, and use that to achieve your goal. Here’s a tutorial on input actions:

Yes I am aware of what Enhanced Input Actions are however I tried them and they dont work.

The settings are in place and the ICM is added at the same time but they dont fire.

Also tried “Down” “Hold” settings with the exec. pin coming from “ongoing” and “started” , I have tried cursor over events but to no luck. : /

Could you show all the related parts of your blueprint code? But the version you implemented the input actions

To add mouse events right click in BP, type “mouse” or go to input then mouse, and select the button
or movement axis you’d like to bind functionality to, it will place a mouse button or movement event in your BP

I have got it working in the end.

Not sure why Enhanced Input Actions werent working before but for some reason they are now.

The solution I found was stopping the tick event in the actor based on whether or not the right mouse button is pressed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.