浏览代码

Add random scale

Fernando Serrano 5 年之前
父节点
当前提交
039a75df49
共有 1 个文件被更改,包括 4 次插入1 次删除
  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 );
 
 							}