Inverse third person character movement.

Wondering how I can inverse the player’s input for a moment. (1 second) So W = S and A = D for a specified time. e.g I have a function and I call it to inverse the player’s movement so when pressing W I will walk backward and S I will walk forwards. Then once the second is up, the regular mappings are restored. Any help on how to do this would be very appreciated. I’m quite new to blueprints just so you know :slight_smile: Thanks!!

Or use the Negate Node

Just toggle the Inverse Movement Input variable as needed.

Oh thanks for this, will try it in a bit! :slight_smile:

So this didn’t work for me. (in the video, “InverseMovement” is set to false) Upon pressing any key, (WASD) it will move forward in the direction of the camera. I want the player to be able to press A and it will act as D. Or W will act as S. Regardless of camera direction. Base third person character movement but the keys are opposite for a moment. (most suitably an event or function) Also during this video, I am pressing every key and it will only move forward to where the camera is pointed.

In this video “Inversemovment” is set to true. I cannot move :confused:

Works on my end exactly as it should.

Movement take a float of 1, 0, or -1.

Forward/Backward: 1 = Forward, -1 Backward

Inversing a 1 would output -1, thus backward.

Same applies to Right/Left.

1 = Right, -1 = Left

ill try with a plain default character and see. Also your “X” and “Y” variables are default set to 1, yes? And a difference I see with yours and mine is that my variables do not have the “f” on the right corner. I’m assuming it’s a function variable. Do you promote “x” and “y” from the function itself as variables or do you just create 2 new float variables named “x” and “y”

When I make the variables while inside the function they will be normal variables without an “F”

X/Y are 0.0 by default. They are directly passed from the IA Event.

I’m running 5.5, the UI has been overhauled in it so that Function local vars do get that F.

This works in all versions of UE.

Alright, ill try it with a blank project. I’ll let you know in a minute

X and Y are function parameters (inputs). They are treated as local vars of the function.

Still isn’t working for some reason. The bool is set to true in this image and player cannot move at all with (WASD)

default value for the function’s inputs (xy) are 0

Here’s mine

How are you retrieving X and Y in the function graph?

Hmmm… strange why it isn’t working. Just to make sure as well, here’s my event graph for my third person char

Haha! I was getting the wrong variable all along. My bad, thanks so much for the help!! Very appreciated

That’s what I figured and why I posted the Get X image

1 Like