Skip to content

Commit 5b82eb9

Browse files
authored
expose session and frame for WebXR (playcanvas#2422)
1 parent 8746592 commit 5b82eb9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/xr/xr-manager.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { XrLightEstimation } from './xr-light-estimation.js';
2727
* @property {pc.Entity|null} camera Active camera for which XR session is running or null.
2828
* @property {pc.XrInput} input provides access to Input Sources.
2929
* @property {pc.XrHitTest} hitTest provides ability to hit test representation of real world geometry of underlying AR system.
30+
* @property {object|null} session provides access to [XRSession](https://developer.mozilla.org/en-US/docs/Web/API/XRSession) of WebXR
3031
*/
3132
function XrManager(app) {
3233
EventHandler.call(this);
@@ -124,6 +125,18 @@ XrManager.prototype.constructor = XrManager;
124125
* });
125126
*/
126127

128+
/**
129+
* @event
130+
* @name pc.XrManager#update
131+
* @param {object} frame - [XRFrame](https://developer.mozilla.org/en-US/docs/Web/API/XRFrame) object that can be used for interfacing directly with WebXR APIs.
132+
* @description Fired when XR session is updated, providing relevant XRFrame object.
133+
* @example
134+
* app.xr.on('update', function (frame) {
135+
*
136+
* });
137+
*/
138+
139+
127140
/**
128141
* @event
129142
* @name pc.XrManager#error
@@ -457,7 +470,7 @@ XrManager.prototype.update = function (frame) {
457470
}
458471
}
459472

460-
this.fire('update');
473+
this.fire('update', frame);
461474
};
462475

463476
Object.defineProperty(XrManager.prototype, 'supported', {

0 commit comments

Comments
 (0)