Phaser3 - Add acceleration and drag to vehicle on Physics arcade engine

I am making a simple top down car game in Phaser3. At the moment, my car moves at a constant speed. However, I would like it to behave more realistically, with elements such as drag/friction/acceleration applied to it, a bit like the example at http://domasx2.github.io/gamejs-box2d-car-example/. How do I get it to behave this way using the Phaser Physics arcade engine (which the rest of my game currently uses).

I have tried to implement this here: stackblitz.com/edit/phaser3-typescript-d6zbzf but the acceleration doesn’t continue when I let go of the forward key. Also the brake doesn’t seem to be working. Could someone please have a look and help me?

Thank you so much this is excellent!

1 Like