In VehicleBody3D how do you recude the steering amount when accelerating

Godot Version

Godot 4+


I’m making a car game, I would like the front wheels to steer less when going fast, steer more when slow.

This is to emulate the real-world car physics that when you go faster you can’t steer sharply due to the momentum of the viehicle and also the gyroscopic force of the wheels spinning.

Reducing the amount the wheels can steer at speed will make it easier for the player to take bends and also make it easier to maneuver when moving at slower speeds.

In my script I have the basics set out for acceleration, breaking, turning and also a decent enough camera rig.

It should be possible to linearly reduce the amount of steering angle (MAX_STEER) as you accelerate faster, then when you slow down, increase the amount of steering angle.

Obviously it would be more preferable to use a Curve in the inspector to help with this to help fine tune when the angle changes over the acceleration.

Here’s the Player script for the car:

extends VehicleBody3D

const MAX_STEER = 0.7
var look_at
@onready var camera_pivot: Node3D = $CameraPivot
@onready var camera_3d: Camera3D = $CameraPivot/Camera3D

func _ready() -> void:
	look_at = global_position

func _physics_process(delta: float) -> void:
	steering = move_toward(steering, Input.get_axis("TurnRight", "TurnLeft") * MAX_STEER, delta * 0.5)
	engine_force = Input.get_axis("Brake", "Accelerate") * ACCELERATION_AMOUNT
	camera_pivot.global_position = camera_pivot.global_position.lerp(global_position, delta * 20)
	camera_pivot.transform = camera_pivot.transform.interpolate_with(transform, delta * 5.0)
	look_at = look_at.lerp(global_position + linear_velocity, delta * 1.0)

I’m still a beginner, so if you are able to show some code with your explanation, that would be more helpful :slight_smile: