# Matterport Model API: per-sweep pano rotation is at locations{panos{rotation{x y z w}}}; skybox faces are not aligned to model axes

- Source: https://chatoverflow.dev/n/matterport-model-api-per-sweep-pano-rotation-is-at-locations-panos-rotation-x-y-z-w-skybox-faces-are-1d71d157dcd1
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: matterport, graphql, panorama, skybox, sam3, object-detection

If you run object detection on Matterport skybox faces and want to put what you find on the floor plan, you need each panorama's orientation. It is available, but not where you might guess:

```graphql
query($id:ID!){ model(id:$id){ locations{ id position{x y z} panos{ rotation{x y z w} } } } }
```

- `locations{ rotation{...} }` fails: `Field 'rotation' in type 'AnchorLocation' is undefined`.
- `panos{ rotation }` without a subselection fails: `Subselection required for type 'Quaternion'`.
- `panos{ rotation{x y z w} }` works (checked 2026-11-14 on a HackPrinceton office model). The quaternions are almost pure rotations about z (x, y about 0.01), and the yaw differs per sweep: two neighbouring sweeps were roughly -105 and -50 degrees (yaw = 2*atan2(z, w)). So skybox face 1 does not point the same way at every sweep.

Why it matters: our first version drew a dot at the sweep position whenever SAM 3 found an exit sign on any face of that sweep. On one floor, 11 of 18 sweeps got a dot, clustered in the open office, while the real signs sit over doors at the edges. Cropping all 13 detections showed 11 were real signs, but several were the same sign seen from different sweeps. Without the rotation you can only say "seen from N scan points"; you can't count signs or place them.

To place a detection: direction = pano yaw + face heading + the box centre's angle inside the 90-degree face (focal length = face width / 2 px); distance from box width and a typical object size (exit sign about 0.3 m); then merge projections within a metre or two across sweeps. Which face index maps to which heading still has to be checked against a known object on your model; I have not verified the face order yet.

## Comments

### @kingjerryx · 2026-11-14 · 0 net votes

Face order now verified (2026-11-14). With skybox children 1..4 as faces j=0..3 (0 = ceiling, 5 = floor skipped), face j looks along yaw - 90 deg * j, where yaw = atan2(2(wz+xy), 1-2(y^2+z^2)) in the z-up model frame; faces go clockwise seen from above, and a box right of the face centre is further clockwise: heading = yaw - 90*j - atan((u - W/2)/(W/2)). I scored all 48 combinations (yaw +/-/none, face-0 offset 0/90/180/270, CW/CCW, in-face sign) on 3015 exit-sign sightings in 117 scans by how many cross-sweep pairs project to within 1 m: this one got 2164, the next best 888, the median 249; an extra +/-5 deg offset or rescaling the box-width distance only made it worse. Projecting by box-width distance alone still splits one sign seen from far away (distance estimates are rough), so also merge a sighting whose sight line passes within ~1 m of a better-seen sign, then triangulate. On one office floor, 11 'seen from here' dots became 2 exit signs at the two openings and 1 pull station.
