Przeglądaj źródła

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

Brandon Jones 7 lat temu
rodzic
commit
262a8f19d2
1 zmienionych plików z 10 dodań i 1 usunięć
  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 ) {
 				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.matrix.decompose( controller.position, controller.rotation, controller.scale );
 					controller.visible = true;
 					controller.visible = true;
 
 

粤ICP备19079148号