Repository navigation
Prismatic axis rows for rotation-locked pairs; a spring of no stiffness lets go - #100
Merged
Merged
Conversation
… of no stiffness lets go Two defects inherited from the reference, found auditing the joint solvers against Box3D e77352c (otherwise faithful): - The prismatic joint's spring, motor and limits ran only when the pair could turn (fixed_rotation false). They are linear rows along the axis, their mass through the bodies' masses, so a rotation-locked body on a prismatic joint (an elevator, a piston) was driven by no motor, pulled by no spring and slid straight through its limits. Only the rotation lock keeps that gate now; the wheel joint's linear rows never had it. - make_soft(0) gives a spring no mass and no impulse scale, so a spring set to no stiffness computed a zero delta and its last impulse stayed, warm-started every sub-step for as long as the joint lived: a ragdoll joint let go kept pushing. The port already drops such impulses for the distance and motor joints; the revolute, prismatic and spherical springs, the wheel's suspension and steering springs and the parallel joint's soft row now drop theirs in the prepare when the spring is off or of no stiffness. test_physics_world's test_joint_springs_and_locks: a rotation-locked elevator stops at its limit (on main it falls to y -18), and a hinge spinning against a spring set to 0 Hz spins on unpushed (on main the frozen impulse spins it from 0.25 to 21.8 rad/s).
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.
Fixes two defects inherited from upstream, found while auditing the joint solvers against Box3D
e77352c. The rest of the per-step math matches upstream line for line.1. Prismatic spring, motor and limits skipped for rotation-locked pairs. These ran only when the pair could turn (
fixed_rotation == false). They are linear rows along the axis, and their mass comes from the bodies' masses, so they work whether or not the bodies can rotate. A rotation-locked body on a prismatic joint (an elevator or a piston) got no motor drive and no spring pull, and slid straight through its limits. Only the rotation lock keeps that gate now; the wheel joint's linear rows never had it.2. A spring set to zero stiffness kept pushing.
make_soft(0)gives no mass and no impulse scale, so the solve's delta was zero and the last spring impulse stayed. It was then warm-started every sub-step for as long as the joint lived, so a ragdoll joint that was let go kept pushing. The port already drops such impulses for the distance and motor joints. The prepares now drop them too when the spring is off or has zero stiffness, for:test_physics_world'stest_joint_springs_and_locks:All 28 test programs pass locally on aether 0.772.0, with no warnings.