Browse Source

Add random scale

Fernando Serrano 5 years ago
parent
commit
039a75df49
1 changed files with 4 additions and 1 deletions
  1. 4 1
      examples/webxr_vr_haptics.html

+ 4 - 1
examples/webxr_vr_haptics.html

@@ -193,11 +193,14 @@
 							if ( box.intersectsSphere( sphere ) ) {
 
 								child.material.emissive.b = 1;
-								gamepad.hapticActuators[ 0 ].pulse( child.userData.index / group.children.length, 100 );
+								const intensity = child.userData.index / group.children.length;
+								child.scale.setScalar( 1 + Math.random() * 0.1 * intensity );
+								gamepad.hapticActuators[ 0 ].pulse( intensity, 100 );
 
 							} else {
 
 								child.material.emissive.b = 0;
+								child.scale.setScalar( 1 );
 
 							}