What the code below does is adding FallingLateralFriction when one of the WASD keys is released, but what I need is to add FallingLateralFriction when none of the WASD keys are pressed at the same time - so I need it to detect if any of the WASD keys are being inputed, if not, add FallingLateralFriction.
Create a Boolean Variable for each key input and set it as true or false depending on whether or not it has been released.
Then, off of Event Tick, create a branch that where it takes an OR operator and you input each of the Boolean Variables for the key inputs. That way if one of the Key Inputs is true, the branch will go true. If all are false, the branch will go false.
Hook up your Lateral Friction Falling Code
(Optional) On Event Begin play, Use a Set Tick Interval node and the value at .1 (1/10th of a second). That should help optimize the tick function if you’re worried about it running every frame.
I hope this helps and let me know if this makes sense!
Not quite! It doesn’t look like the values are ever set to true so it will always trigger false. Also try to use positives as your Boolean values. Having it as Not Pressed is confusing (at least to me :))
Lets do W for an example:
Create a Boolean variable called W Pressed.
From the W Event, Set the W is Pressed Variable to True off the Pressed Execution Pin. Then set the W is Press Variable to false off the Released Execution Pin.
I think you’ll want to use Get Variables rather than pulling the Pins directly from the Set Variables as well.
I’ll try to throw this into an example BP when I get home tonight so its a bit more clear.
Is there a way to print it like this? Why can’t I use one duplicate event that is already declared in other code, like “Event OnLanded” or “Event BeginPlay”?