Ivan Kmeťo bded14a506 Automatic brake/reverse
Value fwd_mps converts global velocity into a velocity vector which is rotated to cars local coordinate system (in this example x-axis).
Then if key "ui_down" is pressed and the fwd_mps value is greater or equal to -1 (which seems to be very good spot and represents car still moving forward but nearly standing still) the car reverses (negative engine_force_value). If this condition isn't met (which means the car is moving forward) then the car brakes.

Tested and working on Godot 3.1 Beta 3.

Suggestions:
In this case, if you want something more realistic, the -engine_force_value can be much lower because no car reverses in same speed as it goes forward but for the sake of demo project I left it as it is.

Created for my own project with help of user wombatstampede from godotdevelopers.org/forum
2019-02-06 05:59:45 +01:00
2019-02-06 05:59:45 +01:00
2018-12-15 14:45:28 -03:00
2018-01-16 17:46:10 +02:00
2018-12-14 23:59:16 +01:00
2018-03-13 22:35:55 -07:00
2018-03-13 22:35:55 -07:00
2018-05-18 23:16:27 +02:00
2016-04-29 10:59:40 +02:00

Godot demo projects

Each folder containing a project.godot file is a demo project meant to be used with Godot Engine, the open source 2D and 3D game engine.

Important note

  • The master branch is compatible with the latest Godot version (currently 3.0).
  • Use the appropriate branch for your Godot version, such as the 2.1 branch for Godot 2.1.x.

License

Those demos are distributed under the terms of the MIT license, as described in the LICENSE.md file.

Description
Demonstration and Template Projects
Readme 1.2 GiB
Languages
GDScript 89%
C# 9.4%
JavaScript 0.7%
GLSL 0.5%
Shell 0.2%
Other 0.2%