Export fragment and prop physics into model.json (SIX-188) #251

Manually merged
github merged 2 commits from gh-pr/251/head into gh-pr/251/base 2026-11-26 20:21:38 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 06:14 UTC · original
holdmysocks:six-188-frag-physics → master · +806 −3 · 6 files · 2 commits · merged 2026-11-25 06:41 UTC

Exports fragment and prop physics into model.json (SIX-188).

ft models get a physics block decoded from the fragment's physics LOD. dr models get their embedded composite bound. Both get an archetype block from the ytyp archetype and the object tuning table. Member exports (--member) are unchanged.

What is exported

Fragments (physics.kind = "fragment")

  • Root: mass, angular inertia, centre of gravity, bounding sphere, gravity factor, max speed, max angular speed, buoyancy, 6 damping vectors, minimum move force, and raw flag words.
  • Groups: name, parent, child groups, children, mass, strength, force transmission up and down, minimum damage force, damage health, joint stiffness, a named tuning map, the 36 raw tuning values and the raw flag words.
  • Children: group, bone and bone name, mass, inertia, rotation, offset, world position, in-use flag, flags, and the child's bound (type, bbox, centroid, CG, volume).

Drawables (physics.kind = "drawable")

  • The composite bound's children: type, bbox, centroid and transform.

Archetype (archetype)

  • ytyp flags (hex and set bits), a dynamic guess, and the archetype's tuning keys.
  • The matching object tuning entry from data, if any: object mass, centre of mass offset, buoyancy factor, max health, max speed, plus the other fields by hash.

Confirmed

Checked on all 40,705 decodable level fragments, or against the fragment tuning presets in common.

  • Root mass: the archetype mass equals the sum of the in-use child masses on every fragment.
  • Group mass: the sum of the children in the group's child range. Ranges count record positions, and agree with each child's group index on all 153,028 groups.
  • Child inertia: mass × the bound's volume distribution.
  • Child position: bone pivot + offset.
  • Group name: joaat of the group's bone name.
  • Group tree: parent, child-group and child links.
  • Tuning slots: strength, force transmission up and down, minimum damage force, damage health, joint stiffness, motor frequency, damping and max torque, joint limit strength, angle plastic deflection, the per-impact-type damage scales (melee, weapon, vehicle, ped, horse, ragdoll, explosion, object), and the ped / weapon / ped-melee inverse-mass scales and bike scale. Slot positions match the presets exactly, e.g. a chain-link fence preset matches on 16 of 16 values; tree, bush, sign and rock presets also match.
  • Object tuning table: keyed by the archetype's 64-bit key (1,532 entries). The streetlight's key matches its entry.

Likely, not proven

  • Minimum move force (root +0xBC): -1 (never moves) on trees, gates, signs and poles; 100 to 500 on loose props; 0 on vehicle parts.
  • Root group strength as the force to break free of the world: e.g. bins 100, trees -1.
  • Units of strength and min_damage_force: not stated anywhere in the data, and the presets give plain numbers. They are probably compared against the collision impulse (kg·m/s) rather than a force in N, but that is unproven. Treat them as relative thresholds, -1 = unbreakable, and calibrate against the child masses.
  • Gravity, speed, buoyancy and damping order: follows the older engine's layout, and the values look right (gravity 1, damping 0.02 / 0.01).
  • Tuning slots marked unconfirmed in the map: weapon health, joint latch strength, limit elasticity, plastic deflection speed, horse and vehicle inverse-mass scales.
  • dynamic = archetype flag bit 17: set on every ft archetype and on 8% of dr. Bit 24 is also set on every ft, and bit 29 only on dr. Other bits are exported raw.

Not decoded

  • Exported raw: group flag words, root flag words and child type / include flags. One candidate: group bit 0 = break when damaged.
  • Bound types 2, 9 and 13: given by number only.
  • Not found: damaged masses and joint limit angles.
  • dr phArchetype: dr props carry no phArchetype, so there is no mass or inertia for them. The tuning table's object mass is the only source, and it is often -1 (use the default).
  • Fragments without a physics LOD: cloth, glass panes and flags (about 10k) give physics: null.

Plausibility samples

  • Streetlight: 2,531 kg. Pole chunks are 1,486 and 1,000 kg, strengths 1500 / 500 / 100 (glass), and it never moves.
  • Bin: 70 kg, min move force 100, root strength 100.
  • Bollard: 9.9 kg.
  • Wooden crate: 2,000 kg.
  • Corrugated metal fence: 200 kg, strength 500, min damage force 250, health 500, stiffness 0.5.
  • Oak: 4,870 kg, never moves.
  • Air-con cage (dr): 21 bound children, 1.44 m³.

Notes

  • Archetype flags: need a fresh lod-links run, because the archetype cache now stores flags and tuning keys.
  • Object tuning table: built on first use from an indexed data archive, then cached in the work dir.
  • Research examples: fragsurvey and archflagstats reproduce the survey numbers above.

Tests: fragphys unit tests cover a synthetic fragment (groups, spare child record, tuning, positions), broken layouts, a drawable composite bound and the tuning table entry.

**@⁠holdmysocks** on GitHub · 2026-11-25 06:14 UTC · [original](https://github.com/holdmysocks/SixNG/pull/251) `holdmysocks:six-188-frag-physics` → `master` · +806 −3 · 6 files · 2 commits · merged 2026-11-25 06:41 UTC Exports fragment and prop physics into `model.json` (SIX-188). `ft` models get a `physics` block decoded from the fragment's physics LOD. `dr` models get their embedded composite bound. Both get an `archetype` block from the ytyp archetype and the object tuning table. Member exports (`--member`) are unchanged. ## What is exported **Fragments (`physics.kind = "fragment"`)** - Root: mass, angular inertia, centre of gravity, bounding sphere, gravity factor, max speed, max angular speed, buoyancy, 6 damping vectors, minimum move force, and raw flag words. - Groups: name, parent, child groups, children, mass, strength, force transmission up and down, minimum damage force, damage health, joint stiffness, a named tuning map, the 36 raw tuning values and the raw flag words. - Children: group, bone and bone name, mass, inertia, rotation, offset, world position, in-use flag, flags, and the child's bound (type, bbox, centroid, CG, volume). **Drawables (`physics.kind = "drawable"`)** - The composite bound's children: type, bbox, centroid and transform. **Archetype (`archetype`)** - ytyp flags (hex and set bits), a `dynamic` guess, and the archetype's tuning keys. - The matching object tuning entry from data, if any: object mass, centre of mass offset, buoyancy factor, max health, max speed, plus the other fields by hash. ## Confirmed Checked on all 40,705 decodable level fragments, or against the fragment tuning presets in common. - **Root mass:** the archetype mass equals the sum of the in-use child masses on every fragment. - **Group mass:** the sum of the children in the group's child range. Ranges count record positions, and agree with each child's group index on all 153,028 groups. - **Child inertia:** mass × the bound's volume distribution. - **Child position:** bone pivot + offset. - **Group name:** joaat of the group's bone name. - **Group tree:** parent, child-group and child links. - **Tuning slots:** strength, force transmission up and down, minimum damage force, damage health, joint stiffness, motor frequency, damping and max torque, joint limit strength, angle plastic deflection, the per-impact-type damage scales (melee, weapon, vehicle, ped, horse, ragdoll, explosion, object), and the ped / weapon / ped-melee inverse-mass scales and bike scale. Slot positions match the presets exactly, e.g. a chain-link fence preset matches on 16 of 16 values; tree, bush, sign and rock presets also match. - **Object tuning table:** keyed by the archetype's 64-bit key (1,532 entries). The streetlight's key matches its entry. ## Likely, not proven - **Minimum move force (root +0xBC):** -1 (never moves) on trees, gates, signs and poles; 100 to 500 on loose props; 0 on vehicle parts. - **Root group strength as the force to break free of the world:** e.g. bins 100, trees -1. - **Units of `strength` and `min_damage_force`:** not stated anywhere in the data, and the presets give plain numbers. They are probably compared against the collision impulse (kg·m/s) rather than a force in N, but that is unproven. Treat them as relative thresholds, -1 = unbreakable, and calibrate against the child masses. - **Gravity, speed, buoyancy and damping order:** follows the older engine's layout, and the values look right (gravity 1, damping 0.02 / 0.01). - **Tuning slots marked unconfirmed in the map:** weapon health, joint latch strength, limit elasticity, plastic deflection speed, horse and vehicle inverse-mass scales. - **`dynamic` = archetype flag bit 17:** set on every `ft` archetype and on 8% of `dr`. Bit 24 is also set on every `ft`, and bit 29 only on `dr`. Other bits are exported raw. ## Not decoded - **Exported raw:** group flag words, root flag words and child type / include flags. One candidate: group bit 0 = break when damaged. - **Bound types 2, 9 and 13:** given by number only. - **Not found:** damaged masses and joint limit angles. - **`dr` phArchetype:** `dr` props carry no phArchetype, so there is no mass or inertia for them. The tuning table's object mass is the only source, and it is often -1 (use the default). - **Fragments without a physics LOD:** cloth, glass panes and flags (about 10k) give `physics: null`. ## Plausibility samples - **Streetlight:** 2,531 kg. Pole chunks are 1,486 and 1,000 kg, strengths 1500 / 500 / 100 (glass), and it never moves. - **Bin:** 70 kg, min move force 100, root strength 100. - **Bollard:** 9.9 kg. - **Wooden crate:** 2,000 kg. - **Corrugated metal fence:** 200 kg, strength 500, min damage force 250, health 500, stiffness 0.5. - **Oak:** 4,870 kg, never moves. - **Air-con cage (`dr`):** 21 bound children, 1.44 m³. ## Notes - **Archetype flags:** need a fresh `lod-links` run, because the archetype cache now stores flags and tuning keys. - **Object tuning table:** built on first use from an indexed data archive, then cached in the work dir. - **Research examples:** `fragsurvey` and `archflagstats` reproduce the survey numbers above. Tests: `fragphys` unit tests cover a synthetic fragment (groups, spare child record, tuning, positions), broken layouts, a drawable composite bound and the tuning table entry.
ft models get the physics LOD decoded: root mass, inertia, centre of
gravity, damping and min move force; groups with strength, force
transmission, damage and joint tuning; children with mass, bone and
bound. dr models get their composite bound. Both get the ytyp archetype
flags and the matching object tuning entry from data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:21:37 +00:00
github manually merged commit 7b9aa0d767 into gh-pr/251/base 2026-11-26 20:21:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.