An action to remove all forces for platformer object behaviour

There’s an action to stop an object that is being affected by movement forces, but that doesn’t cover the platformer object.

When my inventory or notebook is opened by the player I deactivate the platformer behaviour on my protagonist, set his animation to ‘idle’ and set his current h-movement speed to zero. When the inventory is closed and platformer behaviour is reactivated, my character does a little kick, because he carries some of the forces that were affecting him when the player opened the inventory/notebook (this issue doesn’t happen if the character was idle when the inventory/notebook was opened). There is no way to completely neutralise the forward momentum, to truly stop him as if the player wasn’t pressing left/right before the platformer behaviour was deactivated.

My workaround is to delete and recreate my protagonist, having first captured his position and animation frame so I can apply them to the new instance. I use this fix in many places in my game, and have to bypass it and find other workarounds for any particularly bespoke work in some scenes.

Having a ‘remove all forces’ or ‘stop object completely as if the player was pressing nothing’ type action for the platformer object would be very useful and save a lot of multi-action workarounds to disguise the problem. Thank you.

Edit: I have experimented with the platformer behaviour’s settings: aggressive deceleration, max h-speed, making gravity crushing (and my protag can’t jump anyway!), but I cannot stop the little kick caused by pent-up forces. To summarise that again: if the player is pressing left or right when platformer behaviour is deactivated - AKA if he was walking/moving - he will do a little kick when it is reactivated.

My solution for this is just always to:

  1. Set a variable that has to be false for my character’s controls to work (since I don’t use default controls).
  2. When I want the object to stop, set that variable to true AND set deceleration to a ginormous number (at least 10000), and set acceleration/max speed to 0 for one frame. The speed/decel has to be after the disabling of controls, otherwise it’s queued up in some way.
  3. Have another event (at the top of the event list or just underneath any at the beginning of scene events) that checks for that variable to be true, then set it back to false. That way it happens the next frame.

I haven’t tested it for a while, but that worked for years. The only time I got a kick was if I tried disabling the behavior (which will generally ignore any changes to it afterwards) or hadn’t disabled their controls via a variable when changing the speeds. All of this said, if you’re using the platformer behavior with non-behavior forces events, I don’t think there’s a solution to this as they are different movement systems from what I understand.

Your idea is wrong
Issue does not come from the fact you are not blocking player movement
Issue comes from the fact you are issuing controls to behavior that is disabled (in other words you are not blocking input to behavior)
And it cue last command until its activated again

Idea is you just disabling behavior is not enough
You should have some vars which would issue controls
For example i made global var ZG.ACTIONHERE to do SOMETHING with player


WASD or arrows
Then press E and again WASD or arrows
Press E again and tell me does it kick a little bit