Browse Source

Reverted webvr_rollercoaster to previous formula.

Mr.doob 8 năm trước cách đây
mục cha
commit
9f0e2a00d1
1 tập tin đã thay đổi với 7 bổ sung7 xóa
  1. 7 7
      examples/webvr_rollercoaster.html

+ 7 - 7
examples/webvr_rollercoaster.html

@@ -103,13 +103,13 @@
 
 					getPointAt: function ( t ) {
 
-						t *= Math.PI;
+						t = t * PI2;
 
-						var x = Math.sin( t * 4 ) * Math.cos( t * 6) * 1000;
-						var y = Math.cos( t * 8 ) * 80 + Math.cos( t * 15 * Math.sin( t ) ) * 40 + 130;
-						var z = Math.sin( t * 5 ) * Math.sin( t * 3 ) * 1000;
+						var x = Math.sin( t * 3 ) * Math.cos( t * 4 ) * 50;
+						var y = Math.sin( t * 10 ) * 2 + Math.cos( t * 17 ) * 2 + 4;
+						var z = Math.sin( t ) * Math.sin( t * 4 ) * 50;
 
-						return vector.set( x, y, z );
+						return vector.set( x, y, z ).multiplyScalar( 20 );
 
 					},
 
@@ -220,7 +220,7 @@
 
 				//
 
-				progress += velocity * delta;
+				progress += velocity;
 				progress = progress % 1;
 
 				position.copy( curve.getPointAt( progress ) );
@@ -231,7 +231,7 @@
 				tangent.copy( curve.getTangentAt( progress ) );
 
 				velocity -= tangent.y * 0.000001 * delta;
-				velocity = Math.max( velocity, 0.00004 );
+				velocity = Math.max( 0.00004, Math.min( 0.0002, velocity ) );
 
 				train.lookAt( lookAt.copy( position ).add( tangent ) );