Skip to content

editor: add WebXR immersive editing workflows - #898

Merged
wass08 merged 11 commits into
pascalorg:mainfrom
sudhir9297:webxr-setup
Sep 22, 2026
Merged

wass08 merged 11 commits into
pascalorg:mainfrom
sudhir9297:webxr-setup

Conversation

@sudhir9297

@sudhir9297 sudhir9297 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Integrates the external WebXR plugin into the standalone editor with feature gating, toolbar entry, God/Human starting modes, wand bindings, and immersive viewer presentation support.
  • Adds shared editor-facing models and spatial interaction primitives for XR build tools, catalogs, material painting, terrain controls, snapping, dragging, and parametric editing.
  • Brings wall, opening, roof, stair, elevator, cabinet, and MEP workflows into parity for spatial pointer input, while preserving desktop behavior.
  • Keeps architecture boundaries explicit by sharing one editor-owned build palette between desktop and XR, narrowing paint subscriptions, and owning the XR runtime dependency in the standalone editor app.

How to test

  1. Run bun install, bun run check-types, and bun run build; all should complete successfully.
  2. Run bun dev and open http://localhost:3002; confirm the editor loads without a runtime error and the WebXR plugin appears in the sidebar.
  3. Open WebXR and confirm the panel shows the Enter VR action, God/Human starting modes, and the controls guide.
  4. Open Build and verify the structure, roof, kitchen, MEP, Painting, and Terrain entries render; open Painting and confirm the material catalog is usable.
  5. In a WebXR-capable browser or emulator, enter VR and verify wand selection, panel interaction, spatial transforms, snapping, and God/Human navigation.

Screenshots / screen recording

Not attached — the interactive WebXR and desktop flows were verified locally on port 3002.

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

High Risk
Large surface area across 3D input, snapping, and scene editing with a new external WebXR stack; regressions could affect both desktop handles and immersive workflows.

Overview
Adds WebXR immersive editing to the open-source standalone editor by registering @webxr/plugin, bundling @react-three/xr (with three/iwer patches), and gating runtime/UI on whether the plugin is installed.

The home page wraps the canvas in a WebXR feature runtime that exposes usePascalWebXR to children, passes immersive into Editor/Viewer, and surfaces Enter VR via PascalWebXRButton on the viewer toolbar. Wand bindings reuse a refactored build palette (build-palette, build-panel-model, roof footprint helpers) shared with the slimmed Build tab.

Spatial pointer paths are threaded through handles, group rotate, wall height resize, grid placement, and pointer-support resolution so controller rays drive drags, snapping, and floor/support picking like desktop. In XR, several desktop-only affordances are suppressed (box select, floating menus, default camera controls, measurement labels). Grid and item placement snap in building-local/world frames via new snapLocalXZInWorld; rotation handles honor continuous descriptors and Alt for unsnapped rotation when angle snap is on.

UI models for catalog, material paint, and tool hints are extracted so XR panels can share desktop logic without duplicating editor state wiring.

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

@pascal

pascal Bot commented Sep 21, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 301330b2-443c-4552-8f72-2210e4a32bc3

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/editor/src/components/editor/index.tsx
Comment thread apps/editor/lib/build-panel-model.ts

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/editor/src/components/editor/wall-move-side-handles.tsx Outdated
Comment thread packages/editor/src/components/editor/handles/use-handle-drag.ts
Comment thread packages/editor/src/components/editor/handles/handle-arrow.tsx
Comment thread packages/editor/src/components/editor/index.tsx Outdated

@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.

Stale Bugbot comment from a previous run.

Comment thread packages/editor/src/components/editor/handles/handle-arrow.tsx
Comment thread packages/editor/src/components/editor/node-arrow-handles.tsx Outdated
sudhir9297 and others added 2 commits September 22, 2026 01:33
# Conflicts:
#	packages/editor/src/components/ui/sidebar/panels/settings-panel/index.tsx
#	packages/editor/src/index.tsx
#	packages/nodes/src/window/tool.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 1 potential issue.

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 c9ed41e. Configure here.

[event.localPosition[0], event.localPosition[2]],
getActiveBuildingPose(),
(value, axis) => snapToGrid(value, dimensions[axis]),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Item snap uses mismatched building frames

High Severity

Floor item snapping now feeds event.localPosition into snapLocalXZInWorld with getActiveBuildingPose(), which resolves the building from the active level first. grid:move localPosition is still produced from selection.buildingId in resolvePointerSupportSurface and useGridEvents, and the placement coordinator overwrites the event with that point. A missing or stale buildingId treats world or scaled XR coordinates as building-local, so items land off-grid or far from the cursor on rotated buildings and in God view.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9ed41e. Configure here.

@wass08
wass08 merged commit d36538b into pascalorg:main Sep 22, 2026
4 checks passed
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.

2 participants