Explorar o código

Enabled damping

WestLangley %!s(int64=7) %!d(string=hai) anos
pai
achega
39df6d2ff4
Modificáronse 1 ficheiros con 6 adicións e 3 borrados
  1. 6 3
      examples/webgl_panorama_cube.html

+ 6 - 3
examples/webgl_panorama_cube.html

@@ -60,9 +60,10 @@
 			camera = new THREE.PerspectiveCamera( 90, window.innerWidth / window.innerHeight, 0.1, 100 );
 			camera = new THREE.PerspectiveCamera( 90, window.innerWidth / window.innerHeight, 0.1, 100 );
 			camera.position.z = 0.01;
 			camera.position.z = 0.01;
 
 
-			controls = new THREE.OrbitControls( camera );
+			controls = new THREE.OrbitControls( camera, renderer.domElement );
 			controls.enableZoom = false;
 			controls.enableZoom = false;
 			controls.enablePan = false;
 			controls.enablePan = false;
+			controls.enableDamping = true;
 
 
 			var textures = getTexturesFromAtlasFile( "textures/cube/sun_temple_stripe.jpg", 6 );
 			var textures = getTexturesFromAtlasFile( "textures/cube/sun_temple_stripe.jpg", 6 );
 
 
@@ -130,10 +131,12 @@
 
 
 		function animate() {
 		function animate() {
 
 
-			renderer.render( scene, camera );
-
 			requestAnimationFrame( animate );
 			requestAnimationFrame( animate );
 
 
+			controls.update(); // required when damping is enabled
+
+			renderer.render( scene, camera );
+
 		}
 		}
 
 
 		</script>
 		</script>