Hello! I’m trying to trigger a vignette effect based on movement. Basically If the character is NOT moving, I want the vignette to disappear. The vignette works but I can’t figure out how to trigger it according to character movement. I have WASD controls on input axis, but since there is no “pressed” or “released” that I know of Idk how to test if movement is true or false. Any help would be much appreciated, thank you!
Have you tried creating something like a isMoving bool variable in the Character blueprint, that’s going to be set to true only when the character is moving?
Then create a delegate(Event Dispatcher) that’s going to trigger the vignette in the Level blueprint.
I don’t know if it’s the most efficient way, but it works. Here’s an example
This is Event Tick in Character Blueprint:
We have 3 steps:
- 1st we set isMoving to true if the character speed is > 0;
- 2nd, if the isMoving is same as the TempIsMoving(another variable we created just to help us keep track if the “isMoving” changes) we call the Event Dispatcher “Change Moving”
- 3rd step is to reset the TempIsMoving variable
This system keeps track of character isMoving and calls an Event Dispatcher whenever that variable changes.
This is Level Blueprint Begin Play event:
It binds the Event Dispatcher to the CustomEvent_0. Branch True gets fired when the character starts moving, False gets fired when the character stops moving. (Just connect it to your desired Timelines, here I created a simple image that changes opacity from 1 to 0 and vice versa)
Hope that helps.
Thanks @MihailoML ! I ended up moving the vignette stuff to the Character blueprint which made things a lot easier. This is what worked:
Glad you figured it out! Yeah, putting it in the Character blueprint is probably smarter, since you won’t have to rewrite the same code for other levels (if your game has more then one level).