Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vehiclewheel don't work correctly #82517

Closed
Q3dlaXpoaQ opened this issue Sep 29, 2023 · 8 comments
Closed

vehiclewheel don't work correctly #82517

Q3dlaXpoaQ opened this issue Sep 29, 2023 · 8 comments

Comments

@Q3dlaXpoaQ
Copy link

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

@Calinou
Copy link
Member

Calinou commented Oct 1, 2023

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.

@mathphye
Copy link

mathphye commented Oct 1, 2023

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.

@Zireael07
Copy link
Contributor

Scaled collision shapes are known to not to work in most physics nodes.

@mathphye
Copy link

mathphye commented Oct 1, 2023

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.

@mathphye
Copy link

mathphye commented Oct 1, 2023

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.

image

@Q3dlaXpoaQ
Copy link
Author

Q3dlaXpoaQ commented Oct 2, 2023

Thanks, but after I changed the center of mass, it can worked, but when I changed something others, the vehiclewheel embedded in the ground.
Godot_v4 1 1-stable_mono_win64_BFIWmBjDWd
Godot_v4 1 1-stable_mono_win64_pJOxcgFiKe
Godot_v4 1 1-stable_mono_win64_ODmnJndOkh

Then I tried many arguments, but it either embedded in the ground, or the center of mass was too front or too rear.

@mathphye
Copy link

mathphye commented Oct 2, 2023

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.

@Q3dlaXpoaQ
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants