Enable/Disable character movement

Hello.

In my project I want to disable the character movement on keypress and enable it on release. I managed to disable it when it’s pressed but I cant seem to find a “enable character movement” node in blueprints.

I tried using “disable input/enable input” but that wont work for my project since I still want to be able to turn the camera around.

Anyone got any ideas how I should do this?

You could just create a boolean and link it to branch nodes just after your movement events. Then set the keypress to toggle the boolean on and off.

I’m sorry but I don’t understand what you mean with branch nodes?

I got a boolean that sets to true if mousebutton is pressed and false if it’s released. If it’s true, I disable the movement of my character. If it’s false, I want to enable movement of my character

Hey, branch nodes are one of the most basic units of logic in blueprint - they are the equivalent of an if statement in code, i.e. if <condition> then <logic>, otherwise, <other logic>. Or in your case if <variable to determine if movement stopped> is true then reroute the logic past the moving stuff otherwise continue as you were (for example).

You need to understand the basic nodes to do anything useful in blueprint, you should also get a handle on how your character is actually moved and animated so you know what to stop and start. I would advise going to the unreal page, going to the learn section and watching/reading through the blueprint basics stuff at least before going any further…

glhf

Here’s an example how a branch works from the documentation:

I had a mess around with it, here’s what i did:

534cff119074dc45dc94f09482bc393a01f8a712.jpeg

Marked in blue are the nodes I added to the default player blueprint in the fps scene.

So I am able to trigger the InputQ event by pressing Q on the keypad and that is switching between the boolean being true and false. Then in the movement events I am checking to see if the boolean is true or false before the movement can actually happen. If the boolean is false the player can move, if the boolean is true the player cannot move. (but can still look around because the mouse events have not been modified)

I’m sorry for not explaining correctly what I meant earlier with my questions since I already know what a branch node is(I got plenty of them in my blueprints). Anyways, the fault is mine and I’m sorry if I caused you any problems by not explaining my questions properly.

I’ve decided to remove the “disable movement node” in my blueprint since I found another solution to my problem by setting max walkspeed to 0 and jumpZ velocity - then my character cant walk or jump at all when aiming with the gun. And when I stop aiming with my gun, I just set jump velocity and walkspeed back to normal.

So I managed to solve my problem with another solution.

no prob, glad it got worked out in the end!

OP: can you please delete this whole tread, since now Google thinks this is where to find the opposite of “Disable movement” node in Blueprint, thanks :slight_smile:

I arrived here with the same query. The answer to “Opposite” to “Disable Movement” is what’s being discussed here. There is no “Enable Movement” - instead it’s performed via “Add Movement Input” as described here

It’s “Set Movement Mode: Walking” to Re-Enable Movement