Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

VehicleBody3D

Inherits: RigidBody3D < PhysicsBody3D < CollisionObject3D < Node3D < Node < Object

A 3D physics body that simulates the behavior of a car.

Description

This physics body implements all the physics logic needed to simulate a car. It is based on the raycast vehicle system commonly found in physics engines. Aside from a CollisionShape3D for the main body of the vehicle, you must also add a VehicleWheel3D node for each wheel. You should also add a MeshInstance3D to this node for the 3D model of the vehicle, but this model should generally not include meshes for the wheels. You can control the vehicle by using the brake, engine_force, and steering properties. The position or orientation of this node shouldn't be changed directly.

Note: The origin point of your VehicleBody3D will determine the center of gravity of your vehicle. To make the vehicle more grounded, the origin point is usually kept low, moving the CollisionShape3D and MeshInstance3D upwards.

Note: This class has known issues and isn't designed to provide realistic 3D vehicle physics. If you want advanced vehicle physics, you may have to write your own physics integration using CharacterBody3D or RigidBody3D.

Tutorials

Properties

float

brake

0.0

float

engine_force

0.0

float

mass

40.0 (overrides RigidBody3D)

float

steering

0.0


Property Descriptions

float brake = 0.0

  • void set_brake ( float value )

  • float get_brake ( )

Slows down the vehicle by applying a braking force. The vehicle is only slowed down if the wheels are in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the