Browse Source

r152 (bis) (bis)

Mr.doob 2 years ago
parent
commit
b6ee5983d4

+ 4 - 0
build/three.cjs

@@ -25670,6 +25670,7 @@ class WebXRController {
 
 						joint.matrix.fromArray( jointPose.transform.matrix );
 						joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
+						joint.matrixWorldNeedsUpdate = true;
 						joint.jointRadius = jointPose.radius;
 
 					}
@@ -25718,6 +25719,7 @@ class WebXRController {
 
 						grip.matrix.fromArray( gripPose.transform.matrix );
 						grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
+						grip.matrixWorldNeedsUpdate = true;
 
 						if ( gripPose.linearVelocity ) {
 
@@ -25762,6 +25764,7 @@ class WebXRController {
 
 					targetRay.matrix.fromArray( inputPose.transform.matrix );
 					targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
+					targetRay.matrixWorldNeedsUpdate = true;
 
 					if ( inputPose.linearVelocity ) {
 
@@ -25989,6 +25992,7 @@ class WebXRManager extends EventDispatcher {
 
 			if ( controller !== undefined ) {
 
+				controller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );
 				controller.dispatchEvent( { type: event.type, data: event.inputSource } );
 
 			}

+ 4 - 0
build/three.js

@@ -25675,6 +25675,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 							joint.matrix.fromArray( jointPose.transform.matrix );
 							joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
+							joint.matrixWorldNeedsUpdate = true;
 							joint.jointRadius = jointPose.radius;
 
 						}
@@ -25723,6 +25724,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 							grip.matrix.fromArray( gripPose.transform.matrix );
 							grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
+							grip.matrixWorldNeedsUpdate = true;
 
 							if ( gripPose.linearVelocity ) {
 
@@ -25767,6 +25769,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 						targetRay.matrix.fromArray( inputPose.transform.matrix );
 						targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
+						targetRay.matrixWorldNeedsUpdate = true;
 
 						if ( inputPose.linearVelocity ) {
 
@@ -25994,6 +25997,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 				if ( controller !== undefined ) {
 
+					controller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );
 					controller.dispatchEvent( { type: event.type, data: event.inputSource } );
 
 				}

File diff suppressed because it is too large
+ 0 - 0
build/three.min.js


+ 4 - 0
build/three.module.js

@@ -25668,6 +25668,7 @@ class WebXRController {
 
 						joint.matrix.fromArray( jointPose.transform.matrix );
 						joint.matrix.decompose( joint.position, joint.rotation, joint.scale );
+						joint.matrixWorldNeedsUpdate = true;
 						joint.jointRadius = jointPose.radius;
 
 					}
@@ -25716,6 +25717,7 @@ class WebXRController {
 
 						grip.matrix.fromArray( gripPose.transform.matrix );
 						grip.matrix.decompose( grip.position, grip.rotation, grip.scale );
+						grip.matrixWorldNeedsUpdate = true;
 
 						if ( gripPose.linearVelocity ) {
 
@@ -25760,6 +25762,7 @@ class WebXRController {
 
 					targetRay.matrix.fromArray( inputPose.transform.matrix );
 					targetRay.matrix.decompose( targetRay.position, targetRay.rotation, targetRay.scale );
+					targetRay.matrixWorldNeedsUpdate = true;
 
 					if ( inputPose.linearVelocity ) {
 
@@ -25987,6 +25990,7 @@ class WebXRManager extends EventDispatcher {
 
 			if ( controller !== undefined ) {
 
+				controller.update( event.inputSource, event.frame, customReferenceSpace || referenceSpace );
 				controller.dispatchEvent( { type: event.type, data: event.inputSource } );
 
 			}

File diff suppressed because it is too large
+ 0 - 0
build/three.module.min.js


+ 8 - 1
examples/webxr_xr_dragging.html

@@ -201,6 +201,8 @@
 
 				}
 
+				controller.userData.targetRayMode = event.data.targetRayMode;
+
 			}
 
 			function onSelectEnd( event ) {
@@ -217,11 +219,12 @@
 
 				}
 
-
 			}
 
 			function getIntersections( controller ) {
 
+				controller.updateMatrixWorld();
+
 				tempMatrix.identity().extractRotation( controller.matrixWorld );
 
 				raycaster.ray.origin.setFromMatrixPosition( controller.matrixWorld );
@@ -233,6 +236,10 @@
 
 			function intersectObjects( controller ) {
 
+				// Do not highlight in mobile-ar
+
+				if ( controller.userData.targetRayMode === 'screen' ) return;
+
 				// Do not highlight when already selected
 
 				if ( controller.userData.selected !== undefined ) return;

+ 8 - 4
examples/webxr_xr_paint.html

@@ -88,6 +88,14 @@
 
 				function onSelectStart() {
 
+					this.updateMatrixWorld( true );
+
+					const pivot = this.getObjectByName( 'pivot' );
+					cursor.setFromMatrixPosition( pivot.matrixWorld );
+
+					const painter = this.userData.painter;
+					painter.moveTo( cursor );
+
 					this.userData.isSelecting = true;
 
 				}
@@ -181,10 +189,6 @@
 					painter.lineTo( cursor );
 					painter.update();
 
-				} else {
-
-					painter.moveTo( cursor );
-
 				}
 
 			}

Some files were not shown because too many files changed in this diff