Skip to content

Commit c4168f2

Browse files
authored
[XR] correct rotation application in RHS (#13596)
1 parent e8264f8 commit c4168f2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/dev/core/src/XR/webXRCamera.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export class WebXRCamera extends FreeCamera {
175175
this._lastXRViewerPose = undefined;
176176
}
177177

178+
private _rotate180 = new Quaternion(0, 1, 0, 0);
179+
178180
private _updateFromXRSession() {
179181
const pose = this._xrSessionManager.currentFrame && this._xrSessionManager.currentFrame.getViewerPose(this._xrSessionManager.referenceSpace);
180182
this._lastXRViewerPose = pose || undefined;
@@ -260,6 +262,8 @@ export class WebXRCamera extends FreeCamera {
260262
currentRig.position.z *= -1;
261263
currentRig.rotationQuaternion.z *= -1;
262264
currentRig.rotationQuaternion.w *= -1;
265+
} else {
266+
currentRig.rotationQuaternion.multiplyInPlace(this._rotate180);
263267
}
264268
Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, currentRig._projectionMatrix);
265269

0 commit comments

Comments
 (0)