@@ -26,12 +26,15 @@ class WebXRManager extends EventDispatcher {
2626
2727 let session = null ;
2828 let framebufferScaleFactor = 1.0 ;
29+ var poseTarget = null ;
2930
3031 let referenceSpace = null ;
3132 let referenceSpaceType = 'local-floor' ;
3233 let customReferenceSpace = null ;
3334
3435 let pose = null ;
36+ var layers = [ ] ;
37+
3538 let glBinding = null ;
3639 let glProjLayer = null ;
3740 let glBaseLayer = null ;
@@ -72,6 +75,12 @@ class WebXRManager extends EventDispatcher {
7275
7376 this . isPresenting = false ;
7477
78+ this . getCameraPose = function ( ) {
79+
80+ return pose ;
81+
82+ } ;
83+
7584 this . getController = function ( index ) {
7685
7786 let controller = controllers [ index ] ;
@@ -497,6 +506,12 @@ class WebXRManager extends EventDispatcher {
497506
498507 }
499508
509+ this . setPoseTarget = function ( object ) {
510+
511+ if ( object !== undefined ) poseTarget = object ;
512+
513+ } ;
514+
500515 this . updateCamera = function ( camera ) {
501516
502517 if ( session === null ) return ;
@@ -518,8 +533,9 @@ class WebXRManager extends EventDispatcher {
518533
519534 }
520535
521- const parent = camera . parent ;
522536 const cameras = cameraVR . cameras ;
537+ var object = poseTarget || camera ;
538+ const parent = object . parent ;
523539
524540 updateCamera ( cameraVR , parent ) ;
525541
@@ -532,11 +548,11 @@ class WebXRManager extends EventDispatcher {
532548 cameraVR . matrixWorld . decompose ( cameraVR . position , cameraVR . quaternion , cameraVR . scale ) ;
533549
534550 // update user camera and its children
551+ object . matrixWorld . copy ( cameraVR . matrixWorld ) ;
552+ object . matrix . copy ( cameraVR . matrix ) ;
553+ object . matrix . decompose ( object . position , object . quaternion , object . scale ) ;
535554
536- camera . matrix . copy ( cameraVR . matrix ) ;
537- camera . matrix . decompose ( camera . position , camera . quaternion , camera . scale ) ;
538-
539- const children = camera . children ;
555+ const children = object . children ;
540556
541557 for ( let i = 0 , l = children . length ; i < l ; i ++ ) {
542558
0 commit comments