0 votes

So I am trying to figure out how the VehicleBody works, and my setup is this right now:

- Meshinstance of a car
- VehicleWheel (4x for each wheel, and each has a mesh instance of a wheel as child)
(Also, all the VehicleWheels are pointing backwards and have the same size)

After that:
1. I instanced that scene into another scene with a staticBody as a floor
2. I set the VehicleWheel nodes in the back to have useastraction to be true; the two front ones got useassteering = true
3. On the VehicleBody I set engine_force to be 200

The problem now is that this doesn't work. While the car has gravity and makes contact with the floor, it doesn't drive forwards.

Even more confusing: When I manually set the engine force of the wheel in the backright to 0, then the car is moving forwards but with a drift to the right (as would be expected if only the left wheel moves) but when I set the engine force of the wheel on the backleft to 0, then the car is moving backwards with a leftward drift.

So it seems like the 2 wheels in the back are moving in the opposite direction and cancel each other out, is that correct? If someone could explain to me what I am doing wrong that would be amazing!

in Engine by (242 points)
edited by

1 Answer

0 votes

Nevermind, sorry about that.

The problem was a number of reasons:
1. The VehicleWheels need to point in the forward direction, not backward (I already facepalmed myself...)
2. The scaling got messed up when setting up the car with one wheel being scaled by -1

Making sure that both backwheels have the same transform and point in the right (forward) direction was needed.

by (242 points)
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.