Issue with bool variable setup in character blueprint

e168467f9b809bbf796dcdade48048520196a4b2.jpeg

Trying to setup a bool variable in the character blueprint that is true when the player is not moving. First screenshot is the character BP event graph, the second is the function bPlayerNotMoving.
In the current setup is is always on, even if he is moving.

You must watch this: Floating Point Numbers - Computerphile - YouTube
Really watch it, he talks about your problem (or causes of it).

And only after you watched above video you should use this node: nearly equal

Or simply put there if its less than 10 or so.

I don’t think that is the problem. I have the same setup in a widget, calling the exact same function and it correctly displays the boolean depending on player speed. I would like to know if there is something wrong in the setup I have created.

b1e18f42c92dac5d0de8442a4f63a24fac853744.jpeg

Removed the function and put the complete sequence directly into the graph and it worked. Still I am wondering what went wrong in the first attempt.

You are setting the variable after each tick, but in reality it should be set only if the player does or does not move. This condition alone is the BOOLEAN that needs to be TRUE for the camera to shake. You don’t need ta call a check every tick, since it is already asking the Boolean if it is true or not.

I don’t get what you mean. At some point the game has to check every tick whether the player is moving.

Add “Do once with reset” after branch in camera shake graph.
If it starts shaking and never stop Xintoc was right.
then you need to add some delay and reset do once gate.

Your node after your function needs to be a get, not a set.

What I mean is Imagine Event Tick as a burst of TICK TICK TICK TICK times infinity per second. Now before the camera shake could end, there comes another tick saying “Hey, start the shake animation again!”


Here it is set up so that When the player speed is not equal to “0” then event tick will play “MyShake” Camera shake Once and after the duration of the animation the event tick is allowed to play it once more.

There is probably a better method to loop the shake while holding down a certain input/key which would get rid of the Event Tick entirely.

Thanks for the example, it is very useful.