Browse Source

Updated WebXR input to use XRRays when provided by the browser.

Brandon Jones 7 years ago
parent
commit
262a8f19d2
1 changed files with 10 additions and 1 deletions
  1. 10 1
      src/renderers/webvr/WebXRManager.js

+ 10 - 1
src/renderers/webvr/WebXRManager.js

@@ -240,7 +240,16 @@ function WebXRManager( renderer ) {
 
 				if ( inputPose !== null ) {
 
-					controller.matrix.elements = inputPose.pointerMatrix;
+					if ('targetRay' in inputPose) {
+
+						controller.matrix.elements = inputPose.targetRay.transformMatrix;
+
+					} else if ('pointerMatrix' in inputPose) {
+
+						controller.matrix.elements = inputPose.pointerMatrix;
+
+					}
+
 					controller.matrix.decompose( controller.position, controller.rotation, controller.scale );
 					controller.visible = true;