@wombatstampede said:
VehicleBody is derived from RigidBody so you can use the property "linear_velocity" to get a Vector3 with the velocity vector.
If your VehicleBody is i.e. named "MyCar" then you would get the moving speed with $MyCar.linear_velocity.length().
If you assume one size unit as one meter then this would be the speed in m/sec. Multiply with 3.6 to get km/h.
It seems it's more complicated as I thought before and I would have to count also with angle of the car itself or something. So how this works now is that I press key when velocity is above f.e. 1, then i brake. However, if I brake until velocity is less than 1 and then I start to reverse, the velocity of the car won't go over 1 in reverse mode, obviously.
if Input.is_action_pressed("ui_down"):
if (speed < 1):
throttle_val = -0.5
else:
brake_val = 1.0