Skip to content

fix(templates): apply rotation as well as scale before grounding the origin - #412

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/origin-to-base-rotation
Oct 5, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
fix/origin-to-base-rotation

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Closes #389.

Problem

ai-mesh-cleanup and the pipeline template applied transforms only when scale was non-identity. origin_to_base() shifts the geometry along local Z. So an imported glTF node with a rotation and unit scale, which is common, was grounded along the wrong axis and moved in world space.

Change

  • scale_is_identity() is replaced by rot_scale_is_identity(), which checks the full 3×3 of matrix_basis, in both the skill and the template. Rotation is now applied too, so local Z equals world Z before grounding. The template's existing log line ("Applied object scale/rotation") is now accurate.
  • origin_to_base() documents its precondition.
  • Skill steps 3 and 4 explain the ordering, with the measured failure.

Evidence

Proven by live run (--factory-startup; binaries report 5.2.1 LTS and 4.5.11 LTS). The probe imports the real template helpers; the cube is rotated 90° on X at z=5 with unit scale:

Gate World bbox before World bbox after Unchanged
New rot_scale_is_identity [-1,-1,4]..[1,1,6] [-1,-1,4]..[1,1,6] (origin z = 4.0, on the base) True (both versions)
Old scale-only (falsifier) [-1,-1,4]..[1,1,6] [-1,-2,3]..[1,0,5] False (both versions)
  • An identity-transform object: the gate returns True, so there is no needless apply.
  • The pipeline template on the CI fixture (make_pipeline_glb.py, unity preset, --collider convex) exits 0 on both versions: evaluated_tris=2208, LOD0 = 1024.

Not done: a rotated-input smoke fixture for the template. The CI fixture has no rotation, so CI exercises the new gate only on the identity path. The probe above is the rotated-case evidence.

🤖 Generated with Claude Code

…origin

ai-mesh-cleanup and the pipeline template applied transforms only when
scale was non-identity. origin_to_base() shifts geometry along local Z,
so an imported glTF node with a rotation and unit scale (common) was
grounded along the wrong axis and moved in world space: a cube rotated
90 deg on X at z=5 shifted -1 in Y and Z.

The gate is now rot_scale_is_identity(), which checks the whole 3x3 of
matrix_basis, so rotation is applied too and local Z equals world Z
before grounding. origin_to_base() states the precondition and the skill
explains why steps 3 and 4 must run in that order.

Closes #389

Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TMHSDigital

Copy link
Copy Markdown
Owner Author

CI evidence before merge: all checks pass ( 13 pass ). Blender Smoke on PR head: Blender 5.2.2 LTS / Blender 4.5.14 LTS. Summaries (happy path; falsifiers) per leg: 141 passed, 3 skipped, 0 failed;136 passed, 6 skipped, 0 failed;143 passed, 1 skipped, 0 failed;142 passed, 0 skipped, 0 failed;

@TMHSDigital
TMHSDigital merged commit 8960f3f into main Oct 5, 2026
13 checks passed
@TMHSDigital
TMHSDigital deleted the fix/origin-to-base-rotation branch October 5, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skills/templates: origin_to_base shifts geometry along local Z, moving rotated objects in world space

1 participant