Skip to content

Commit 912496c

Browse files
committed
fix: incorrect camera aspect ratio
1 parent 16b4877 commit 912496c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/xr/src/store.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,12 +678,15 @@ export function createXRStore<T extends XRElementImplementations>(options?: XRSt
678678
if (session == null || xrManager == null) {
679679
return
680680
}
681+
const xrCamera = xrManager.getCamera()
682+
//update camera aspect ratio
683+
xrCamera.aspect = xrCamera.projectionMatrix.elements[0] / xrCamera.projectionMatrix.elements[5]
684+
681685
const currentLayers = session?.renderState.layers
682686
if (currentLayers == null) {
683687
return
684688
}
685689
//layer sorting
686-
const xrCamera = xrManager.getCamera()
687690
xrCamera.getWorldPosition(cameraWorldPosition)
688691
;(layerEntries as Array<XRLayerEntry>).sort((entryA, entryB) => {
689692
const renderOrderDifference = entryA.renderOrder - entryB.renderOrder

0 commit comments

Comments
 (0)