VehicleWheel3D bug?

Godot Version

4.3 on Windows

Question

I’m following this 3d racing game tutorial, one of the first steps after making a car scene, is to add VehicleWheel3D nodes as parents of each wheel. Then set the rear ones as traction and the front ones as steering. And then write a script to move the car and steer the wheels. Problem is, for whatever reason, the rear wheels are the ones steering. And they’re steering around the wrong position (car center apparently).

What am I missing?

Maybe the local coordinates of VehicleWheel3D are offset? But this doesn’t explain why the rear wheels are steering.

Here’s the script attached to the VehicleBody3D:

extends VehicleBody3D

func _ready() -> void:
	pass

func _process(delta: float) -> void:
	steering = move_toward(steering, Input.get_axis("ui_right", "ui_left") * 0.8, delta * 2.5)
	engine_force = Input.get_axis("ui_up", "ui_down") * 300 # speed

bug

Looks like the wheels are positioned at the center of the car and only the meshes are moved into the correct position. You should reset the positions of the meshes and move the wheel nodes into the correct position instead.

Not sure why the rear wheels are steering though…

Select the mesh Circle_001 and then add him a child node wheelnode3d. You cant copy the wheels beacuse every wheel has his own position, own data, own pivot point. Basically every mesh need his own wheelnode3d, not viceversa.

I tried to fix this on Blender and failed miserably :sweat_smile:, is there a way of fixing this in Godot instead?

Yes, every mesh has it’s own parent VehicleWheel3D, which was originally added as a child of the wheel and then reparented to maintain the mesh’s position.

Oh I see, so I guess it’s because the wheel’s origin point is at the center of the car in blender?

If so, in blender just select the wheel, then in object mode, in the ‘object’ menu → set origin → origin to geometry. That should set the origin at the center of the wheel mesh. You can do it to all the wheels one by one.

Then I think when you import it to godot, the wheel mesh will be at the center of the car (even if it’s in the correct position in blender), but then you can parent them to the wheel nodes and move the actual wheel nodes into the correct position.

That worked! Also, when looking at each wheel mesh transform in Blender, “Rotation W” was set to 1.0, which I’ve just set to 0.0. Maybe the weird rotation that explains why the rear wheels were turning. In any case, fixing the model on Blender resolved the issues.

Thanks a lot!

image

1 Like