godot-demo-projects/3d/truck_town/README.md

40 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2020-03-08 02:29:42 +01:00
# Truck Town
This is a demo implementing different types of trucks of
varying complexity using vehicle physics.
Controls:
- <kbd>Up Arrow</kbd>, <kbd>W</kbd>, <kbd>Gamepad Right Trigger</kbd>, <kbd>Gamepad A/Cross</kbd>: Accelerate
- <kbd>Down Arrow</kbd>, <kbd>S</kbd>, <kbd>Gamepad Left Trigger</kbd>, <kbd>Gamepad B/Circle</kbd>, <kbd>Gamepad X/Square</kbd>: Brake/reverse
- <kbd>Left Arrow</kbd>, <kbd>Gamepad Left Stick</kbd>, <kbd>Gamepad D-Pad Left</kbd>: Steer left
- <kbd>Right Arrow</kbd>, <kbd>Gamepad Left Stick</kbd>, <kbd>Gamepad D-Pad Right</kbd>: Steer right
- <kbd>U</kbd>, <kbd>Gamepad Select</kbd>, left-click speedometer: Change speedometer unit (m/s, km/h, mph)
- <kbd>C</kbd>, <kbd>Gamepad Y/Triangle</kbd>: Change camera (exterior, interior, top-down)
- <kbd>Escape</kbd>, <kbd>Gamepad D-Pad Up</kbd>: Go back to menu (press again to exit)
On mobile platforms, the vehicle automatically accelerates. Touch the left and
right edges of the screen to steer. Touch the middle of the screen to
brake/reverse (this also temporarily stops acceleration).
2020-03-08 02:29:42 +01:00
Language: GDScript
Renderer: Forward+
2020-03-08 02:29:42 +01:00
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2752
2020-03-08 02:29:42 +01:00
## How does it work?
The base vehicle uses a
[`VehicleBody3D`](https://docs.godotengine.org/en/latest/classes/class_vehiclebody3d.html)
2020-03-08 02:29:42 +01:00
node. The trailer truck is tied together using a
[`ConeJointTwist`](https://docs.godotengine.org/en/latest/classes/class_conetwistjoint.html)
node, and the tow truck is tried together using a chain made of
[`RigidBody3D`](https://docs.godotengine.org/en/latest/classes/class_rigidbody3d.html)
2020-03-08 02:29:42 +01:00
nodes which are pinned together using
[`PinJoint`](https://docs.godotengine.org/en/latest/classes/class_pinjoint.html) nodes.
## Screenshots
![Screenshot](screenshots/truck_town.webp)