0 votes

I am trying to create a driving mechanic but I just cannot seem to make the vehicleBody node work. Here is my setup:

I created a world scene that has a CSGBox with the collision enabled, just to have some kind of floor.

Then I created another scene that has a VehicleBody as the root node and 4 VehicleWheels as children, with each of them having an appropriate Mesh attached. The mesh for each wheel is a child of the respective VehicleWheel node, they are in the same place and the only attribute I changed of the VehicleWheel nodes was the radius to make them the same size as the wheels.

This scene was then instanced into the level scene. (I also added a camera, but I suppose that doesn't matter to the car)

Once I tried to run all of this I encountered a lot of problems:

First, the body of the car would be too heavy and drop all the way to the floor. Also, the wheels would clip partially through the floor. I tried to address this by adjusting the rest length of each wheel. This did make the wheels kinda work, although each wheel would still clip through the floor a tiny bit. But now the car would be very unstable and tilt forwards. Especially confusing was that even though the different wheels had the same rest length, the car still wobbled forwards.

I tried to play with the other attributes of the wheels, but none seemed to fix the issues and there doesn't seem to be a detailed guide on how the VehicleBody works, or at least I couldn't find one...

My questions would be:
1. Does the radius of the VehicleWheel node need to be the same as the mesh it surrounds and does it need to be in the center of it (as opposed to being on the outer or inner side of it)?
2. Did the car in my game wobble because I need to experiment for each wheel's rest length and find the perfect balance or is there an easier way?
3. Is there a decent guide online that explains how the VehicleBody works? That would be insanely helpful.

Edit: Here are pictures of my setup

Car scene
Car scene

Game result
https://i.ibb.co/T4yVK1p/game.png

Instanced scene
https://i.ibb.co/6Yw1sjf/level.png

in Engine by (242 points)
edited by

Hi,
can you provide a screenshot of the setup and of the sceneTree? With the given informations the answer can only be very vague.

Hi, thanks for the help.

Here are the pictures of the setup and the game result:
Engine: https://ibb.co/wJrLHwn
Level: https://ibb.co/D4W8K0S
Result: https://ibb.co/dPZdbt1

just figured out how to add images, they are added now to the original post :)

I have the same issue. Have found an answer to your Q? I watched the samevideo and even downloaded the guys version from github. It has this problem too. I am thinking maybe this is an environemtn related problem.

1 Answer

0 votes

I highly recommend this tutorial to learn all about how VehicleBody works:

https://www.youtube.com/watch?v=B5vE-nNszxA

by (20,475 points)

Hi, thanks for the answer. I did find the tutorial but I didn't found it particularly useful: When the car is imported all the relevant parts are set up automatically but I try to understand how to set up a car myself. And there is really little available on that :(

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.