Skip to content

feat(wall): add endHeightOffset for sloped top edge - #640

Open
vducasse wants to merge 3 commits into
pascalorg:mainfrom
vducasse:feat/wall-end-height
Open

feat(wall): add endHeightOffset for sloped top edge#640
vducasse wants to merge 3 commits into
pascalorg:mainfrom
vducasse:feat/wall-end-height

Conversation

@vducasse

@vducasse vducasse commented Aug 12, 2026

Copy link
Copy Markdown

What does this PR do?

Adds an endHeightOffset property to the WallNode schema to allow wall extremities to have different heights (e.g., for creating a knee wall following a single-pitch roof slope). This adds an "End height offset" slider to the wall properties panel and updates the geometry generation to apply the slope along the top edge of the wall.

How to test

  1. Open a scene in the editor and draw a standard wall.
  2. Select the wall to open the properties panel.
  3. Under the dimensions/properties, look for the new End height offset slider.
  4. Adjust the slider and verify that the top edge of the wall tilts smoothly between the start and end points.

Screenshots / screen recording

image image image image

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

Medium Risk
Touches core wall schema persistence and the main extrusion/CSG path; sloped tops may interact with face-band height logic and material assignment that still assume a flat effective height. Debug logging in the viewer path would spam the console on every rebuild until removed.

Overview
Adds optional endHeightOffset on walls so the top edge ramps from the start (unchanged) to a taller end—useful for knee walls along a single-pitch roof—without reshaping the plan footprint.

The wall schema documents and validates the field (non-negative, meters). The wall properties panel gets an End height offset slider (0–3 m, unit-aware) under the top dimensions. Extruded wall mesh generation applies applyWallEndHeightSlope after the standard extrude: vertices on the flat top at topY are raised along local X by a linear blend from 0 at start to endHeightOffset at end, before normals, material groups, and opening CSG.

Note: the new geometry helper still includes console.log debug output that should be removed before merge.

Reviewed by Cursor Bugbot for commit 402111e. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/nodes/src/wall/panel.tsx
Fixes a bug where negative offset values caused wall geometry to self-intersect and drop below the base. The value is now strictly clamped to 0 at the Zod schema, UI, and geometry generation layers.
const rawOffset = wallNode.endHeightOffset
console.log('[applyWallEndHeightSlope] called', { rawOffset, wallLength, topY, height: wallNode.height })
if (!rawOffset || wallLength < 1e-9) {
console.log('[applyWallEndHeightSlope] early return', { rawOffset, wallLength })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logs in slope helper

Medium Severity

applyWallEndHeightSlope still contains temporary console.log calls, including on the early-return path. generateExtrudedWall runs this for every wall rebuild (render and collision), so the console fills with debug output even when endHeightOffset is unset.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f9213c2. Configure here.

# Conflicts:
#	packages/nodes/src/wall/panel.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 402111e. Configure here.

for (let i = 0; i < position.count; i++) {
if (Math.abs(position.getY(i) - topY) > 1e-4) continue
const t = THREE.MathUtils.clamp(position.getX(i) / wallLength, 0, 1)
position.setY(i, topY + endHeightOffset * t)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curved walls warp sloped top

Medium Severity

applyWallEndHeightSlope drives the top height from chord-local X / wallLength, while curved footprints offset the two faces along arc normals. Those opposite-edge vertices get different local X values at the same station, so front and back tops rise by different amounts and the top surface warps whenever curveOffset and endHeightOffset are both set.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 402111e. Configure here.

if (Math.abs(position.getY(i) - topY) > 1e-4) continue
const t = THREE.MathUtils.clamp(position.getX(i) / wallLength, 0, 1)
position.setY(i, topY + endHeightOffset * t)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placement height ignores end offset

Medium Severity

Geometry can extend above the flat wall top by endHeightOffset, but height helpers used for wall placement and overlays still resolve only the unsloped top. Near the taller end, wall-mounted items can be snapped or rejected as if the wall stopped at the original height even though the mesh continues higher.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 402111e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant