RFC-0039: Constraint joints (position-based family) and soft bodies
Status: Normative. The language gains a pairwise constraint stage, solved by deterministic position relaxation (mirroring the reference PhysicsSystem constraint stage), and soft bodies built from the same constraints. Joints act on the EIR component surface (transform positions, velocity, rigid_body mass), so they compose with gravity/integrate/ground_contact and remain byte-identical across the interpreter and JIT.
Joints
systems {
joint { on = a; other = b; type = distance; length = 1.0; stiffness = 1.0 }
joint { on = a; other = b; type = spring; length = 1.0; stiffness = 20; damping = 0.5 }
joint { on = a; other = b; type = weld; stiffness = 1.0 }
joint { on = a; other = b; type = hinge; anchor = (0,0,0) }
joint { on = a; other = b; type = ball; anchor = (0,0,0) }
joint { on = a; other = b; type = prismatic; axis = (1,0,0); limit = (0.0, 2.0) }
iterations = 8
}
Rules:
- Lowering. A
jointsystem lowers once, for entityon = a. Each iteration reads the current positions ofaandb(cross-entityReadView), computes a correction, and writes both back (WriteView).iterations(default 4) repeats the sweep;on = a; other = b. - Mass weighting. Each side moves by
inv_mass = is_dynamic ? 1/mass : 0, split byinv_a / (inv_a + inv_b); a joint withinv_a + inv_b == 0is a no-op. Jointed bodies must declaremass(ordynamic) so arigid_bodyexists. - Kinds (positional):
distance— keep|a − b| = length;stiffnessscales the correction.spring— asdistanceplus velocity damping along the axis (damping).weld/hinge/revolute/ball/spherical— coincide the anchor points (pos_a + anchorandpos_b + anchor). In this point-mass engine these differ only in the rotational DOF, which is not simulated; they are positionally identical.prismatic/slider— keepbon the line throughaalongaxis;limit = (lo, hi)clamps the along-axis separation.
- Angular joints are rejected.
cone,twist,universal,gear,rack,pulley, and motors enforce rotational or ratio constraints; the engine has no rotational state, so they fail with a clear diagnostic rather than silently under-constraining. - Determinism. All reads/writes are existing opcodes; the solver is a fixed-order sweep, so results are reproducible and identical on both backends.
Soft bodies
Implemented in RFC-0040 on top of distance/spring constraints.