VehicleWheel3D

Inherits: Node3D < Node < Object

A 3D physics body for a VehicleBody3D that simulates the behavior of a wheel.

Description

A node used as a child of a VehicleBody3D parent to simulate the behavior of one of its wheels. This node also acts as a collider to detect if the wheel is touching a surface.

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

Tutorials

Properties

float

brake

0.0

float

damping_compression

0.83

float

damping_relaxation

0.88

float

engine_force

0.0

float

steering

0.0

float

suspension_max_force

6000.0

float

suspension_stiffness

5.88

float

suspension_travel

0.2

bool

use_as_steering

false

bool

use_as_traction

false

float

wheel_friction_slip

10.5

float

wheel_radius

0.5

float

wheel_rest_length

0.15

float

wheel_roll_influence

0.1

Methods

Node3D

get_contact_body ( ) const

float

get_rpm ( ) const

float

get_skidinfo ( ) const

bool

is_in_contact ( ) const


Property Descriptions

float brake = 0.0

  • void set_brake ( float value )

  • float get_brake ( )

Slows down the wheel by applying a braking force. The wheel is only slowed down if it is in contact with a surface. The force you need to apply to adequately slow down your vehicle depends on the RigidBody3D.mass of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 30 range for hard braking.


float damping_compression = 0.83

  • void set_damping_compression ( float value )

  • float get_damping_compression ( )

The damping applied to the spring when the spring is being compressed. This value should be between 0.0 (no damping) and 1.0. A value of 0.0 means the car will keep bouncing as the spring keeps its energy. A good value for this is around 0.3 for a normal car, 0.5 for a race car.


float damping_relaxation = 0.88

  • void set_damping_relaxation ( float value )

  • float get_damping_relaxation ( )

The damping applied to the spring when relaxing. This value should be between 0.0 (no damping) and 1.0. This value should always be slightly higher than the damping_compression property. For a damping_compression value of 0.3, try a relaxation value of 0.5.


float engine_force = 0.0

  • void set_engine_force ( float value )

  • float get_engine_force ( )

Accelerates the wheel by applying an engine force. The wheel is only sped up if it is in contact with a surface. The RigidBody3D.mass of the vehicle has an effect on the acceleration of the vehicle. For a vehicle with a mass set to 1000, try a value in the 25 - 50 range for acceleration.

Note: The simulation does not take the effect of gears into account, you will need to add logic for this if you wish to simulate gears.

A negative value will result in the wheel reversing.


float steering = 0.0

  • void set_steering ( float value )

  • float get_steering ( )

The steering angle for the wheel, in radians. Setting this to a non-zero value will result in the vehicle turning when it's moving.


float suspension_max_force = 6000.0

  • void set_suspension_max_force ( float value )

  • float