How to realize an acceleration through a KX_GameObject

Hi all! Please help Me to do a realistic acceleration and braking.
I tried to understand with the game of Martinsh(RGP), but not able.
Please, on a simple example, show correct direction(with the detailed comments).
(Thanks in advance and forgive for my English).
Here my attempt: :slight_smile:


move.blend (90.2 KB)

Ok, here’s a fixed file :slight_smile:
move.blend (91 KB)

What your code used to move the object is called LinearVelocity. Whenever the player would stop pressing a key, it would set the characters movement to 0, making the object stop instantly. I’ve added and If statement which checks if the players pressing a key. If the player is, then it moves the object. If not, then it does nothing and lets blender handle the physics. I’ve also turned up the friction for the ground(In the Materials Panel), so the object stops faster.

Hope that helps :slight_smile:

up top nào các bạn