Skip to content

Fix CSG intersection transform stability for downstream merges#302

Merged
tracygardner merged 3 commits intomainfrom
codex/investigate-mesh-origin-movement-after-merge
Feb 15, 2026
Merged

Fix CSG intersection transform stability for downstream merges#302
tracygardner merged 3 commits intomainfrom
codex/investigate-mesh-origin-movement-after-merge

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Ensure CSG intersection outputs remain in the correct world/merge-space so subsequent merge/boolean operations don't lose placement or orientation.
  • Preserve source orientation when applying properties to CSG result meshes so downstream consumers get the intended rotation.

Description

  • Create CSG result with centerMesh: false and rebuildNormals: true when calling baseCSG.toMesh(...) so the intersected mesh is generated in world-space.
  • Remove the manual recentering step (intersectedMesh.position = combinedCentre) and instead refresh the transform with intersectedMesh.computeWorldMatrix(true) to keep world placement stable.
  • Stop forcing resultMesh.rotationQuaternion = flock.BABYLON.Quaternion.Identity() in applyResultMeshProperties so copied rotation/quaternion data from the reference mesh is preserved.

Testing

  • Ran npm run test:api -- --grep "mergeMeshes geometry preparation|intersectMeshes" which failed in this CI environment because Playwright browser binaries are not installed (Playwright requested npx playwright install).
  • Ran npm run lint which failed due to pre-existing lint issues in flock.js unrelated to this change.
  • Ran npx eslint api/csg.js during development to validate the modified file; linting revealed file-level issues in the repository but the CSG-related logic changes are applied as intended.

Codex Task

@tracygardner tracygardner merged commit 3b54e22 into main Feb 15, 2026
5 checks passed
@tracygardner tracygardner deleted the codex/investigate-mesh-origin-movement-after-merge branch February 15, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments