@@ -878,24 +878,23 @@ setTimeout(function () {
878878
879879 for ( var i = 0 ; i < pose . views . length ; i ++ ) {
880880 var view = pose . views [ i ] ;
881+ var transformMatrix = view . transform . matrix ;
881882 if ( view . eye === "left" || view . eye === "none" ) {
882883 xrData . leftProjectionMatrix = view . projectionMatrix ;
883- xrData . leftViewRotation [ 0 ] = - view . transform . orientation . x ;
884- xrData . leftViewRotation [ 1 ] = - view . transform . orientation . y ;
885- xrData . leftViewRotation [ 2 ] = view . transform . orientation . z ;
886- xrData . leftViewRotation [ 3 ] = view . transform . orientation . w ;
887- xrData . leftViewPosition [ 0 ] = view . transform . position . x ;
888- xrData . leftViewPosition [ 1 ] = view . transform . position . y ;
889- xrData . leftViewPosition [ 2 ] = - view . transform . position . z ;
884+ this . quaternionFromMatrix ( 0 , transformMatrix , xrData . leftViewRotation ) ;
885+ xrData . leftViewRotation [ 0 ] = - xrData . leftViewRotation [ 0 ] ;
886+ xrData . leftViewRotation [ 1 ] = - xrData . leftViewRotation [ 1 ] ;
887+ xrData . leftViewPosition [ 0 ] = transformMatrix [ 12 ] ;
888+ xrData . leftViewPosition [ 1 ] = transformMatrix [ 13 ] ;
889+ xrData . leftViewPosition [ 2 ] = - transformMatrix [ 14 ] ;
890890 } else if ( view . eye === 'right' ) {
891891 xrData . rightProjectionMatrix = view . projectionMatrix ;
892- xrData . rightViewRotation [ 0 ] = - view . transform . orientation . x ;
893- xrData . rightViewRotation [ 1 ] = - view . transform . orientation . y ;
894- xrData . rightViewRotation [ 2 ] = view . transform . orientation . z ;
895- xrData . rightViewRotation [ 3 ] = view . transform . orientation . w ;
896- xrData . rightViewPosition [ 0 ] = view . transform . position . x ;
897- xrData . rightViewPosition [ 1 ] = view . transform . position . y ;
898- xrData . rightViewPosition [ 2 ] = - view . transform . position . z ;
892+ this . quaternionFromMatrix ( 0 , transformMatrix , xrData . rightViewRotation ) ;
893+ xrData . rightViewRotation [ 0 ] = - xrData . rightViewRotation [ 0 ] ;
894+ xrData . rightViewRotation [ 1 ] = - xrData . rightViewRotation [ 1 ] ;
895+ xrData . rightViewPosition [ 0 ] = transformMatrix [ 12 ] ;
896+ xrData . rightViewPosition [ 1 ] = transformMatrix [ 13 ] ;
897+ xrData . rightViewPosition [ 2 ] = - transformMatrix [ 14 ] ;
899898 }
900899 }
901900
0 commit comments