When the player jumps of the wall, I’m adding a permanent force of 600 p/s on x-axis. Once the player falls on the ground I add a permanent force of -20 p/s. The -20 p/s force is being added until speed of the player reaches zero.
This works fine if the force I’m using to stop the player is a divider of the first added force.
Meaning if I use 600 p/s as a starting force, I can only correctly stop it with -5,-10,-15,-20 p/s… and so on.
If the starting force is lets says 567 p/s I can only stop it with -9,-21,-27 p/s…
Otherwise, the player get propelled into other direction instead of stopping.
What is the reason for this, and how can I fix it?
Because if you don’t use a divider, your condition allows a small negative value before stopping.
Change your condition or add another event to set it to 0 if negative.
The reason why I don’t use trigger once when stopping the player is because I want to give a little slide time when falling down, slowing gradually. If I use trigger once with force of only -20 p/s it will never stop, since it’s too small.
However I did try using Trigger once as a sub condition every time the player touches the ground again, stopping force should increase by some x.
This is actually how I noticed the problem.