Skip to content

Conversation

@FuWan722
Copy link

@FuWan722 FuWan722 commented Nov 7, 2025

Fix issue 112492

Modify VehicleBody3D suspension force to follow Hooke's Law.

Before, the suspension force was calculated incorrectly, where:

F(N) = stiffness(N/mm) * offset(m) * vehicle_mass(kg).
Meaning, as the vehicle gets heavier, the spring does not compress. This is because under the hood, the force is also multiplied by vehicle_mass.

before_vehicle_suspension.mp4

After, the suspension force is calculated as:

F(N) = stiffness (N/mm) * 1000.0 * offset(m).
This can be found in the Hooke's Law for spring. Multiplication of 1000.0 to convert N/mm to N/m

after_vehicle_suspension.mp4

@FuWan722 FuWan722 requested review from a team as code owners November 7, 2025 18:56
@FuWan722 FuWan722 changed the title update suspension force calculation to accurately follow Hooke's Law Fix suspension force calculation in VehicleBody3D to accurately follow Hooke's Law Nov 7, 2025
@Zireael07
Copy link
Contributor

Have you considered making a copy of this PR to Bullet Physics? The Vehicle classes are a 1:1 port of Bullet physics

@skorpnok
Copy link

skorpnok commented Nov 7, 2025

You'll need to squash those commits into one to follow the contribution guideline and the unused line of code should probably just be removed not commented out, git handles the history anyways. Otherwise, nice find!

removed unused variable

fix typo

comment out unused variable
@FuWan722 FuWan722 force-pushed the vehicle_wheel_suspension_force branch from 1f7c84e to f4bad53 Compare November 7, 2025 23:01
@shakesoda
Copy link
Contributor

Have you considered making a copy of this PR to Bullet Physics? The Vehicle classes are a 1:1 port of Bullet physics

i'm a bit surprised this issue has persisted in bullet since the class was added in 2006

i have very much run into this and the suspension length issue myself, although the fix might need some extra care/warnings since every project using vehicle bodies would necessarily already be working around this bad behavior

@FuWan722
Copy link
Author

FuWan722 commented Nov 7, 2025

Have you considered making a copy of this PR to Bullet Physics? The Vehicle classes are a 1:1 port of Bullet physics

I can try. Im not too familiar with the Bullet physic engine itself, and the stiffness and damping value in Bullet is a bit vague as I do not know what unit it use (could be either in mm or m). I will probably make a PR removing the mass multiplication over there

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants