Skip to content

Stamp each capture with the headset's pose; pin mapping and export behaviour with tests - #33

Merged
mrhegemon merged 2 commits into
mainfrom
feat/unity-suite-scanner
Nov 25, 2026
Merged

mrhegemon merged 2 commits into
mainfrom
feat/unity-suite-scanner

Conversation

@mrhegemon

Copy link
Copy Markdown
Member

Draft until a capture has been checked on a Quest: the pose fix is covered by tests and a build, not yet by a headset.

What changes

Fix: every capture carried the world origin as its pose. SpatialCapturePipeline creates the passthrough camera object under its own root, which never moves, and MobileCameraProvider.GetCameraPose() reported that object's pose. Each CaptureFrame therefore had position (0, 0, 0) and no rotation, so rays and pins started at the origin instead of at the headset.

  • CapturePose.Resolve rejects a provider pose that is exactly the world origin while the scene camera is more than 5 cm or 1 degree away. It returns the scene camera's pose, and the pipeline logs one warning.
  • MobileCameraProvider reports the pose of a poseSource (the main camera by default). The pipeline sets it when it creates the camera object.

Tests: 184 characterization tests (the first commit, test code only) record what the mapping and export code does today: SemanticLabelMapper, FloorplanBuilder, CaptureFrame, SnapshotFrameStore, GltfExtrasWriter, the exporter's extras and merge logic, BoundingBoxUtils and ViewportRaycaster, plus a golden extras v1 file. Tests whose behaviour looks wrong are named Currently..., so fixing the behaviour later is a deliberate edit of a named test. They sit in their own assembly because the Editor test assembly cannot see Newtonsoft.

Behaviour the tests pin that looks wrong (not changed here)

  • Label mapping matches exact keys only. chair, picture frame, a couch and tables give OTHER, and 16 of the 26 classes in the default prompt end up as OTHER.
  • Re-exporting a space lists every pin twice. Empty input writes "pins": null. A corrupt existing glTF makes every later export of that space throw.
  • CaptureFrame.HasIntrinsics is true for Matrix4x4.identity, which the desktop provider and the no-provider fallback return. A ray through pixel (320, 240) is then almost parallel to the image plane.
  • Snapshot frustum corners come from the live camera, and the 51st snapshot silently drops the oldest.
  • FloorplanBuilder: an L-shaped room's hull fills the notch (area 14, true area 12), the polygon runs counterclockwise so floor normals face down, and a U-shaped boundary inverts one fan triangle.
  • BoundingBoxUtils reads a pixel box (0, 0, 1, 1) as the whole image.
  • ObjectMapper and MappedObjectDatabase are in no scene or prefab and have no callers.

How it was checked

  • EditMode, Unity 6000.6.9f1 in the Windows editor: 388 of 388 pass (197 existing, 191 new).
  • PlayMode: 74 tests, the same result before and after this change. 49 pass, 24 skip (they need a CV server or the Meta simulator), and 1 fails in batch mode: XrSceneScreenshotTests.QaXrScene_CapturesControllersAndAnchors waits for WaitForEndOfFrame, which batch mode does not raise.
  • A Quest debug APK builds from this change with QuestBuilder.Build (10 minutes). It targets API 34, asks for exactly the 7 expected permissions and has a v2 signature.
  • The new pose test that drives a provider stuck at the origin failed before the fix and passes after it.

Not checked

  • Nothing ran on a headset or a phone.
  • .github/scripts/check-quest-package.sh needs the GameCI container. Its checks were repeated by hand with aapt2 and apksigner.

🤖 Generated with Claude Code

mrhegemon and others added 2 commits November 25, 2026 13:32
…tests

184 EditMode tests in 8 files record what the code does today, so later changes show up as
deliberate test edits. They cover SemanticLabelMapper, FloorplanBuilder, CaptureFrame,
SnapshotFrameStore, GltfExtrasWriter, the exporter's extras and merge logic, BoundingBoxUtils
and ViewportRaycaster, plus a golden extras v1 file.

Tests whose behaviour looks wrong are named Currently... and say why (for example: only exact
label keys map, so 16 of the 26 default-prompt classes become OTHER; re-exporting a space lists
every pin twice; an identity intrinsics matrix counts as real intrinsics). Nothing in the
runtime code changes. They live in their own assembly because the Editor test assembly cannot
see Newtonsoft.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SpatialCapturePipeline creates the passthrough camera object under its own root, which never
moves, and MobileCameraProvider reported that object's pose. Every CaptureFrame therefore
carried the world origin, so rays and pins started from the origin instead of the headset.

CapturePose.Resolve rejects a provider pose that is exactly the world origin while the scene
camera is more than 5 cm or 1 degree away, uses the scene camera's pose instead and logs one
warning. MobileCameraProvider now reports the pose of a pose source (the main camera by
default), which the pipeline sets when it creates the camera object.

Seven EditMode tests cover the rule; the one that drives a provider stuck at the origin failed
before the change. Verified in the editor and by a Quest debug build, not on a headset.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mrhegemon
mrhegemon marked this pull request as ready for review November 25, 2026 22:09
@mrhegemon
mrhegemon merged commit 09c8c71 into main Nov 25, 2026
1 check was pending
@mrhegemon
mrhegemon deleted the feat/unity-suite-scanner branch November 25, 2026 22:16
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