Setting Mouse Buttons As Movement

Hello all,

I want to set my game so that when i press both mouse buttons it moves the character forward ive messed around with this for ever and cant figure it out even looked through the forums and YouTube and not a single answer!

I tried making a variable and calling it somehow but no idea how to get it to work!

And or id appreciate how you have two controls under one axis mapping!

Hey, this is by no means the best way but from what I understood this works for what you’re trying to do

I’ll explain it :

Step 1 : Go to your “Project Settings”, Edit>Project Settings, click on the “Input” tab under “Engine” and add two Action Mappings, Call them what ever you want, in this case I called them Mouse1Forward & Mouse2Forward, set them to your right and left mouse buttons.

Step 2 : Go to your “Character” Blueprint and add two “Boolean” variables defaulted to False, I called mine Can Move M1 & Can Move M2.

Step 3 : Copy the blueprints shown in the picture into your “Character” blueprint, hit compile and save.

^ This should work.

Brief explanation(For education) :

I have it set so that when I press My Left Or Right mouse button it sets a boolean to true or false then
EventTick will tick the execution every frame, meaning the Branch node will ask if both Boolean variables where set to True, if they are then move forward.

Hope this helps.

Ok,

I see where your getting at with this never thought of it that way… Hmmm however does it work if you just press left or right on there own and still moves or does it only move forward if you have both pressed?

Not a proper solution, but something you could try:
create an Axis binding named ‘MouseMove’. Add two inputs for this binding. Set leftMouseButton with a weight of 1.0 and Right mouse button with a weight of 1.0. Now in your event graph, create a node for ‘Event MouseMove’. Check that Axis value. If it is > 1.5, then that means both buttons are pressed; and you could proceed to move the character.

I don’t understand the question, what exactly are you trying to make? I need a rough Idea to understand.

Do you mean, when the left button is held, move left and when the right button is held move right but hold them both and you move forward?

Ok, so what I want to do is make it so aswell as my standard forward moment input I would like it so when the condition of mouse buttons left and right are clicked together that it also moves the character forward.

I know it’s something basic and simple but it’s been driving me up the wall trying to figure it out, however I will try both of the solutions I’ve been given by your guys and see what works and if I can work with what I’ve been given a bit further.

Mindfane!!

You good SIR are a magician!

You saved me hours of pain and suffering trying to figure that out, And thank you to everyone else that tried helping me out!

How it now looks for everyone else looking for the answer.

Great!

If the issue is solved, don’t forget to mark the thread as solved. That will help people with similar query later.