SoA: contact force lane renamed LastSubstepForce; hit facts carry an impulse estimate
Box3D exposes no whole-step normal impulse: normalImpulse is the last sub-step and totalNormalImpulse is a solve plus relax mixture, so no lane built from them is true on an impact step. The per-body lane is renamed LastSubstepForce and documented as a resting load only. Impact severity is the hit fact's ImpulseEstimate, v (1 + e) / (1/mA + 1/mB), checked against the ball's momentum change at 60 and 240 Hz, 1 and 4 sub-steps, restitution 0 and 0.5. Also pins that dropped counters reset each step. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a614477d68
commit
5c35a40ccf
4 changed files with 131 additions and 29 deletions
|
|
@ -32,11 +32,16 @@ separate native object (`ymir_box3d_soa.c`, ABI 4) so the Aetheria session's con
|
|||
(world orientation of frame A, quaternion), `joint_rotation` (frame B relative to frame A, quaternion,
|
||||
w >= 0) and `joint_angular_velocity` (B minus A, in frame A). A consumer can compute a joint torque from
|
||||
these and write it as equal and opposite torques on the two body lanes.
|
||||
- Contact lanes (read-only, rewritten by every `step`): `contact_force` (N: the final sub-step's
|
||||
- Contact lanes (read-only, rewritten by every `step`): `last_substep_force` (N: the final sub-step's
|
||||
`normalImpulse` summed over the body's touching manifold points, times sub-steps over dt; 0 for a body
|
||||
touching nothing; the weight at rest), `contact_count` (touching contacts) and `material_id` (the body's
|
||||
`material_id`, also set as the shape's Box3D user material). `totalNormalImpulse` is not used: Box3D adds
|
||||
the accumulated impulse once per solve and once per relax pass, so at rest it reads twice the weight.
|
||||
touching nothing; the weight at rest; NOT an impact measure, it sees one sub-step and misses an impact
|
||||
step by a large factor either way), `contact_count` (touching contacts) and `material_id` (the body's
|
||||
`material_id`, also set as the shape's Box3D user material). Box3D exposes no whole-step impulse:
|
||||
`totalNormalImpulse` adds the accumulated impulse once per solve and once per relax pass (so it reads twice
|
||||
the weight at rest, and on impacts is no fixed multiple of the step's impulse). Impact severity is the hit
|
||||
fact's `impulse_estimate` (N s): `approach_speed * (1 + e) / (1/mA + 1/mB)`, e the larger shape restitution
|
||||
and only above Box3D's restitution threshold, a static body's 1/m taken as 0. Exact for a hit through both
|
||||
centres of mass, an upper bound otherwise (rotation is ignored).
|
||||
- Contact facts: every shape is created with contact and hit events on (Box3D's default is off). After each
|
||||
`step`, `ymir_box3d_soa_get_facts` returns pointers and counts into buffers fixed at create (`fact_capacity`
|
||||
per kind, no allocation in the step): Begin and End `{lane_a, lane_b, stable_id_a, stable_id_b}` and Hit
|
||||
|
|
@ -65,7 +70,8 @@ lanes agreeing, an off-axis hinge, a limit and a weld, a spherical joint leaving
|
|||
torque lanes (exact acceleration, cleared after the step, static bodies ignoring them, NaN refusing the
|
||||
step), capsule and box rest heights with parent and limb lanes, refusals, and bit-identical repeat runs of
|
||||
a torque-driven jointed body. `Box3DSoaContactTests`: a drop gives one begin and one hit (speed within 5%
|
||||
of sqrt(2gh), point and normal), lifting gives one end, resting `contact_force` is the weight, materials on
|
||||
of sqrt(2gh), point and normal), lifting gives one end, resting `last_substep_force` is the weight, the hit `impulse_estimate` matches the ball's momentum change
|
||||
(plus gravity's share) at 60 and 240 Hz, 1 and 4 sub-steps, restitution 0 and 0.5, dropped counters resetting each step, materials on
|
||||
hits, facts lasting one step, overflow counted, per-step byte determinism of facts and contact lanes, and
|
||||
no allocation across 100 steps with fact reads.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue