Repository navigation
perf(fp): seat IK in occupants.sync re-runs only when the vehicle's basis moves - #126
Merged
Merged
Conversation
…asis moves A seated driver's limb pose is a pure function of the vehicle's basis: the sit pose is static, the contact markers are model-space, and the body rides the vehicle rigidly. occupants.sync still re-ran _driver_limbs (and the rider's arm reaches) every frame for every seated vehicle. Memoize per seating: car and scooter drivers re-bend once at seating and when the car's basis changes (a grade, a turn while vis_yaw catches up); bicycle legs follow the cranks, arms only the basis; a rider held at a light with still cranks re-runs nothing. Pinned by an ik_runs counter assert in fp_traffic_test. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Automated reviewNo new findings on the 3 changed files (gdlint, complexity, TODO policy, dead code). Run |
KunalSiyag
added a commit
that referenced
this pull request
Oct 30, 2026
…al (#131) The #99 entry was pinned to Male_Adult_15_head.tres, but the threaded body load races whichever shared head material is in flight: gate logs show Male_Adult_12/15/18, Wood_Male_01 and Business_Male_07. Match the mat/ prefix instead of one variant (fp_car_doors flaked on _12 in #126's gate). Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
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.
What
occupants.syncre-ran the seat IK every frame for every seated driver and rider in range, on poses that cannot change: a car driver's sit pose is a pure function of the car's basis (the body rides the car rigidly and the pedal/wheel markers are car-space), and a rider's legs are a pure function of the crank angle, their arms of the basis alone.The seat points, driver markers and limb bone chains were already cached; this memoizes the IK itself:
_driver_limbsonce at seating and then only when the car'sglobal_transform.basischanges (a grade, or a turn whilevis_yawcatches up).Pin
New public counter
ik_runs(test-only read).fp_traffic_test._check_driver_ik_memoasserts a held car adds no runs across repeat syncs and a turned car adds exactly the re-run — the two properties a regression of either memo would break.Two bugs the suite caught in the first cut (fixed here)
_placeread as the car-only sink float:float(Dictionary)errored every frame and rider roots froze off their seats. The sink read is now gated to car drivers._look_at_carleaves the hero beside a moving car, which deterministically slowed the later resident-driver check by 23 s of sim time (traffic yielding to the hero). It now restores the hero position and the rotated car on exit.Validation
fp_traffic_testPASS (incl. the three new ik-memo pins; resident driver 27.2 s vs main's 26.8 s).tools/gate.sh quick: 180/181 steps PASS; the single FAIL wasfp_car_doors_teston theMale_Adult_12_head.tres"possible cyclic resource inclusion" engine ERROR — a load-race flake also seen on other branches' gate runs this week; the suite's own verdict in that run was PASS and a standalone re-run is PASS with zero such errors.ik_runs).