diff --git a/examples/webvr_cubes.html b/examples/webvr_cubes.html
index c933884c12bae1af4c4c1eb15038a8e2e0a5eb56..f95a23d975126ed122b5c89dc62e370a6039076c 100644
--- a/examples/webvr_cubes.html
+++ b/examples/webvr_cubes.html
@@ -107,9 +107,9 @@
object.scale.z = Math.random() + 0.5;
object.userData.velocity = new THREE.Vector3();
- object.userData.velocity.x = Math.random() * 0.4 - 0.2;
- object.userData.velocity.y = Math.random() * 0.4 - 0.2;
- object.userData.velocity.z = Math.random() * 0.4 - 0.2;
+ object.userData.velocity.x = Math.random() - 0.5;
+ object.userData.velocity.y = Math.random() - 0.5;
+ object.userData.velocity.z = Math.random() - 0.5;
scene.add( object );
cubes.push( object );
@@ -134,6 +134,17 @@
}
+ renderer.domElement.addEventListener( 'click', function ( event ) {
+
+ if ( INTERSECTED ) {
+
+ var object = INTERSECTED;
+ object.userData.velocity.subVectors( object.position, camera.position ).normalize();
+
+ }
+
+ } );
+
//
window.addEventListener( 'resize', onWindowResize, false );
@@ -182,7 +193,7 @@
if ( INTERSECTED ) INTERSECTED.material.emissive.setHex( INTERSECTED.currentHex );
- INTERSECTED = null;
+ INTERSECTED = undefined;
}
@@ -192,6 +203,8 @@
var cube = cubes[ i ];
+ cube.userData.velocity.multiplyScalar( 0.999 );
+
cube.position.add( cube.userData.velocity );
if ( cube.position.x < - 100 || cube.position.x > 100 ) {