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.
HI, thanks for replying. I’ve tried a few different things but couldn’t get it to stop.
I forgot to mention that I’m using platformer behavior to move player as well so I don’t know if that has some influence.
I’ve also tried setting max horizontal speed in platform behavior to be zero, but it has no effect.
What you’re showing seems alright.
Except that permanent force usually comes with a Trigger once condition.
Regarding the platformer behavior, are you not disabling controls during the… dash?
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.
Don’t have to use the dividers with this:
180 - Player.ForceAngle()