#VehicleBody3D Issues

2 messages · Page 1 of 1 (latest)

silent venture
#

Hi! I'm trying to make a car in godot, using the VehicleBody3D. I've set up the car, put all wheels where they're supposed to be, configured them to be used for traction on the back and steering on the front, created a collision shape for my mesh, and added a small script for controlling the vehicle:

extends VehicleBody3D

@export var MAX_STEER: float = PI/4;
@export var ENGINE_POWER: float = 300.0;

func _physics_process(delta: float) -> void:
    steering = lerp(steering, Input.get_axis("ui_right", "ui_left") * MAX_STEER, 4 * delta);
    engine_force = Input.get_axis("ui_down", "ui_up") * ENGINE_POWER;

But for some reason, when i press "ui_down" it moves forwards to the right. Similarly, whenever i press "ui_up" it moves forwards and to the left. When i press "ui_up" and and "ui_left" at the same time, it seems to do what it's supposed to. It moves forwards, and to the left. But now when i press "ui_right" instead of "ui_left", it moves backwards to the right? And again, the same behaviour occurs for pressing "ui_down", the other way round of course. It seems like steering to the right is inverted, but i have no idea why and how to fix this. Why is my car not moving forwards and backwards like it's supposed to, and why is steering to the right inverted?

Settings on back and front wheels, where the one with steering enabled is the front:

silent venture
#

Seems like 2 of the wheels had a -180 degrees rotation, to make the arrows on the wheels be rotated properly like all the others. When i removed this, driving backwards and forwards worked, except it now sank so far into the ground it didnt want to steer anymore at all