Closed Q3dlaXpoaQ closed 11 months ago
This is probably a configuration issue. VehicleWheel works correctly in the Truck Town demo. I advise you check how that demo project's vehicle scenes are configured.
Recently I tried VehicleNode3D and also had a bad moment. At first, it is counterintuitive and it requires to "randomly" change parameters until it kind of works...
I have tested this file, and it looks like a bad collider was assigned. Probably came from mesh>"create single convex collision sibling"
from a mesh that was escalated, thus it doesn't match what is visually the mesh, which gives a wrong perspective of which is the body of the vehicle.
Also, the origin of mass is too high. I think it must be shown in the viewport with a blue dot, so it is completely clear where is located.
Assigning a lower mass origin and changing the size instead of scale, looks like solve temporally the problem. However, the VehicleBody3D shows easy inestability.
Scaled collision shapes are known to not to work in most physics nodes.
Additional observations, the center of mass is not the VehicleBody3D origin as the documentation says:
Note: The origin point of your VehicleBody3D will determine the center of gravity of your vehicle. To make the vehicle more grounded, the origin point is usually kept low, moving the CollisionShape3D and MeshInstance3D upwards.
It is from the collider child...
Also, the collider child shape somehow affects the rotational inertia, which causes the vibration where the shape has fewer length.
For example here when there is a gap between the wheels and the collider it gets "bad behavior". But it works well when the collider shape gets close to the wheels.
Thanks, but after I changed the center of mass, it can worked, but when I changed something others, the vehiclewheel embedded in the ground.
Then I tried many arguments, but it either embedded in the ground, or the center of mass was too front or too rear.
Theoretically, it should work for any center of mass positioned "inside" the four wheels (and it doesn't). However that is not the problem here, I think.
If the center of mass is out of the rectangle (z=-5) formed by the 4 wheels it would end up side down, making some wheels not grounded.
Also, for high mass you should increase stiffness, otherwise, the spring won't have enough force to make the vehicle stand up from the ground.
Theoretically, it should work for any center of mass positioned "inside" the four wheels (and it doesn't). However that is not the problem here, I think.
If the center of mass is out of the rectangle (z=-5) formed by the 4 wheels it would end up side down, making some wheels not grounded.
Also, for high mass you should increase stiffness, otherwise, the spring won't have enough force to make the vehicle stand up from the ground.
Thank you very much! It was so cool that it run correctly. I wonder that if I need to simulate tire attenuation and control the friction force, which argument should I change?
Godot version
4.1.1
System information
win10 godot4.1.1 GLES3
Issue description
When I use godot4, I found that my vehiclewheel didn't work correctly. It sometimes flies everywhere , sometimes don't work. When I ues godot3, it can run correctly.
Steps to reproduce
I use the same step in godot3 to create a 3d car, but it can run in godot3 or can't run in godot4.
Minimal reproduction project
1.zip