fix wheel impulse scaling#947
Open
tomo0613 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#946
explanation by Claude:
The Bug: A misplaced gate in updateFriction
In
update_friction(), after determining thatsliding == true(the combined forward+side impulse exceeds the friction circle), there's a correction loop that scales both impulses down byskid_info. ...The
wheel.side_impulse != 0.0guard is the whole problem. It was presumably written as a micro-optimisation ("skip wheels with no lateral load"), but it incorrectly preventsforward_impulsefrom being scaled down when braking straight — sinceside_impulseis exactly0.0in that case, the entire body of the if is skipped, and the braking impulse is applied without any friction-circle capping.The
skid_info < 1.0check alone is the correct and sufficient guard — it's only< 1.0when the friction circle is actually exceeded, so there's no wasted work. Multiplyingside_impulse(which is already 0.0) byskid_infois a no-op, so removing the outer guard has zero downside.This bug exists in the original Bullet source (lines 675–682 of
btRaycastVehicle.cpp) and was presumably never caught because most demos and tutorials involve some steering before heavy braking — the exact scenario that masks it.