Fragment physics: per-bone joint limits (SIX-210) #277

Manually merged
github merged 3 commits from gh-pr/277/head into gh-pr/277/base 2026-11-26 20:23:51 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 13:55 UTC · original
holdmysocks:six-frag-joints → master · +176 −12 · 4 files · 3 commits · merged 2026-11-25 14:46 UTC

Joint limits in the fragment physics block (SIX-210). The physics version goes from 2 to 3.

What changes

  • New: rotation_limits and translation_limits. Each entry has bone_name, bone_hash, group, min and max. min and max give one value per axis of the bone frame.
    • bone_name is the skeleton bone whose joaat matches bone_hash.
    • group is the group whose name_hash matches. It is null when the bone is not a group.
  • Research examples:
    • jointsurvey writes every level fragment's joint arrays as jsonl.
    • fraggroups now prints each group's bone flags and joint stiffness too.

Where the data is

The main drawable (root +0x18) has a pointer at +0x90 to the joint data:

  • +0x28 u16 count, +0x2C the same count again, +0x30 pointer to the rotation limits
  • +0x38 / +0x3C / +0x40: the same for the translation limits

Each limit is 0x30 bytes: vec4 min, vec4 max, u32 joaat of the bone name, then zero padding.

Confirmed

On the 40,705 level fragments:

  • Layout: 5,310 have joint data, with 17,874 rotation limits and 1,291 translation limits. On every one of them:
    • the second count equals the first
    • the padding is zero
    • min ≤ max on each axis
  • Bones: 98% of the limit bones match a group's bone. The rest match other skeleton bones, such as a briefcase's Lid.
  • Count: on 96% of fragments, the number of rotation limits equals the number of groups whose bone is flagged rotation-limited in the skeleton (bone flag 0x8). The translation count equals the translation-limited groups (0x80) on 99%.
  • Samples:
    • doors and gates: DoorMoverLimit, z from -90° to 90°
    • briefcase: Lid x from -90° to 0°, Handle x from -180° to 0°
    • dream catcher feathers: ±45° on every axis

Units and frame (confirmed)

  • Rotation is in radians. 99.2% of the 107,298 rotation limit values are whole degrees.
  • Translation is in metres. Each range matches the size of the part that moves:
    • the 2.09 m wide sliding shop door slides 2.09 m
    • 0.88 m elevator door panels slide 0.76 m
    • the 3 m garage door lifts 3.24 m
    • a prison cabinet drawer slides 0.4 m
  • The axes are the bone's own frame. On the 12 two-panel elevator landing doors, the left panel's bone is turned 180° about z. Both panels carry the same +x limit, so in the bone frame both open outwards, to ±1.2 m. Read in model axes, the left panel would slide across the middle.
    • The 6 elevator cars are the mirror image: their panels rest open at ±1.21 m and close to ±0.44 m, where the landing panels sit.
  • Not exported: the w of the rotation min/max is always -π / π, and the translation w is always 0.
  • Joint data header +0x10 is 1 on every fragment. Its meaning is unknown, and it is not exported.

Root flags

  • Bit 20 was named has_joints; it is now any_group_joint_angle_plastic_deflection, confirmed. The bit is set exactly when some group has tuning slot 16 above 0: all 1,066 fragments with it, none of the 39,639 without.
  • Bits 16 and 24: now has_breakable_groups, likely; the two bits share the name. They are set on all 11,950 multi-group fragments that have a group able to break off (strength ≥ 0). They are never set on single-group fragments, and only on 80 of the 1,921 multi-group fragments with no breakable group. Those 80 are mostly dishes, clocks, ATMs and cameras.

Unnamed group bits, checked again

Each unnamed bit was compared with the joint limits, the bone flags, all 36 tuning values, the other flag bits and the parent group's flags. No bit has an exact match, so none is named. Two new patterns are recorded in the source:

  • Passed down the group tree: word 0 bits 4, 6, 10, 13, 19, 27 and 31, and word 1 bits 2 and 5, are set on 44–95% of the groups whose parent has them, and on at most 0.8% of the others.
  • Subsets of jointed groups:
    • word 0 bit 21 is on 36 groups, all keypad buttons with translation limits. 1,172 other groups have translation limits without it.
    • bit 17: 84 of its 86 groups have motor_max_torque above 0.
    • bit 25: 223 of its 242 groups are rotation-limited.

Also adds jointbones, a research example that prints each limit with its bone's orientation, and each group's flag words, bone flags and tuning.

Tests: names_flag_bits covers the new root names, with bits 16 and 24 giving one name. decodes_fragment_physics now builds a drawable with one rotation and one translation limit and checks the decode and the JSON. The sixng-core tests pass.

**@⁠holdmysocks** on GitHub · 2026-11-25 13:55 UTC · [original](https://github.com/holdmysocks/SixNG/pull/277) `holdmysocks:six-frag-joints` → `master` · +176 −12 · 4 files · 3 commits · merged 2026-11-25 14:46 UTC Joint limits in the fragment `physics` block (SIX-210). The physics version goes from 2 to 3. ## What changes - **New:** `rotation_limits` and `translation_limits`. Each entry has `bone_name`, `bone_hash`, `group`, `min` and `max`. `min` and `max` give one value per axis of the bone frame. - `bone_name` is the skeleton bone whose joaat matches `bone_hash`. - `group` is the group whose `name_hash` matches. It is null when the bone is not a group. - **Research examples:** - `jointsurvey` writes every level fragment's joint arrays as jsonl. - `fraggroups` now prints each group's bone flags and joint stiffness too. ## Where the data is The main drawable (root +0x18) has a pointer at +0x90 to the joint data: - +0x28 u16 count, +0x2C the same count again, +0x30 pointer to the rotation limits - +0x38 / +0x3C / +0x40: the same for the translation limits Each limit is 0x30 bytes: vec4 min, vec4 max, u32 joaat of the bone name, then zero padding. ## Confirmed On the 40,705 level fragments: - **Layout:** 5,310 have joint data, with 17,874 rotation limits and 1,291 translation limits. On every one of them: - the second count equals the first - the padding is zero - min ≤ max on each axis - **Bones:** 98% of the limit bones match a group's bone. The rest match other skeleton bones, such as a briefcase's `Lid`. - **Count:** on 96% of fragments, the number of rotation limits equals the number of groups whose bone is flagged rotation-limited in the skeleton (bone flag 0x8). The translation count equals the translation-limited groups (0x80) on 99%. - **Samples:** - doors and gates: `DoorMoverLimit`, z from -90° to 90° - briefcase: `Lid` x from -90° to 0°, `Handle` x from -180° to 0° - dream catcher feathers: ±45° on every axis ## Units and frame (confirmed) - **Rotation is in radians.** 99.2% of the 107,298 rotation limit values are whole degrees. - **Translation is in metres.** Each range matches the size of the part that moves: - the 2.09 m wide sliding shop door slides 2.09 m - 0.88 m elevator door panels slide 0.76 m - the 3 m garage door lifts 3.24 m - a prison cabinet drawer slides 0.4 m - **The axes are the bone's own frame.** On the 12 two-panel elevator landing doors, the left panel's bone is turned 180° about z. Both panels carry the same +x limit, so in the bone frame both open outwards, to ±1.2 m. Read in model axes, the left panel would slide across the middle. - The 6 elevator cars are the mirror image: their panels rest open at ±1.21 m and close to ±0.44 m, where the landing panels sit. - **Not exported:** the w of the rotation min/max is always -π / π, and the translation w is always 0. - **Joint data header +0x10** is 1 on every fragment. Its meaning is unknown, and it is not exported. ## Root flags - **Bit 20** was named `has_joints`; it is now `any_group_joint_angle_plastic_deflection`, confirmed. The bit is set exactly when some group has tuning slot 16 above 0: all 1,066 fragments with it, none of the 39,639 without. - **Bits 16 and 24:** now `has_breakable_groups`, likely; the two bits share the name. They are set on all 11,950 multi-group fragments that have a group able to break off (strength ≥ 0). They are never set on single-group fragments, and only on 80 of the 1,921 multi-group fragments with no breakable group. Those 80 are mostly dishes, clocks, ATMs and cameras. ## Unnamed group bits, checked again Each unnamed bit was compared with the joint limits, the bone flags, all 36 tuning values, the other flag bits and the parent group's flags. No bit has an exact match, so none is named. Two new patterns are recorded in the source: - **Passed down the group tree:** word 0 bits 4, 6, 10, 13, 19, 27 and 31, and word 1 bits 2 and 5, are set on 44–95% of the groups whose parent has them, and on at most 0.8% of the others. - **Subsets of jointed groups:** - word 0 bit 21 is on 36 groups, all keypad buttons with translation limits. 1,172 other groups have translation limits without it. - bit 17: 84 of its 86 groups have `motor_max_torque` above 0. - bit 25: 223 of its 242 groups are rotation-limited. Also adds `jointbones`, a research example that prints each limit with its bone's orientation, and each group's flag words, bone flags and tuning. Tests: `names_flag_bits` covers the new root names, with bits 16 and 24 giving one name. `decodes_fragment_physics` now builds a drawable with one rotation and one translation limit and checks the decode and the JSON. The sixng-core tests pass.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:23:50 +00:00
github manually merged commit 69edad6e82 into gh-pr/277/base 2026-11-26 20:23:51 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.