fix(assembly): fix planar half-space correction causing drag flip with cylindrical joints #331
Reference in New Issue
Block a user
Delete Branch "fix/planar-halfspace-drag-flip"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When dragging a body connected by a Cylindrical joint + Distance=0 PlanePlane constraint, every drag step is rejected as 'flipped orientation' (>91 degrees). The solver converges fine but the C++ validator rejects the result, making the part appear frozen during drag.
Root Cause
In
mods/solver/kindred_solver/preference.py, the_planar_half_space()function builds a half-space tracker for PlanarConstraint. When distance=0 (point already on the plane), it usesdot(z_i, z_j)as its indicator and provides a correction function that reflects the body through the plane.When the body rotates about the cylindrical axis, its planar face normal rotates with it. After ~90 degrees of legitimate rotation, the dot product crosses zero, triggering the correction which teleports the body to the opposite side of the plane — a massive orientation change that the 91-degree threshold rightfully rejects.
Fix
Return a tracking-only HalfSpace (no correction_fn) when the point is already on the plane. This matches the pattern used by Cylindrical, Revolute, and Concentric half-space trackers. The cross-product residuals in PlanarConstraint already enforce normal alignment via the solver, so the correction is redundant and harmful during drag.
Testing
All 286 solver tests pass.
See: kindred/solver#38
d5af9804ecto559a240799Not a valid solution to constraint failure problem.
Pull request closed