11var scene = new THREE . Scene ( ) ;
2- var camera = new THREE . PerspectiveCamera ( 75 , window . innerWidth / window . innerHeight , 0.1 , 1000 ) ;
2+ var camera = new THREE . PerspectiveCamera ( 45 , window . innerWidth / window . innerHeight , 0.1 , 1000 ) ;
33var keyboard = new THREEx . KeyboardState ( ) ;
44var clock = new THREE . Clock ( ) ;
55
@@ -73,13 +73,13 @@ function degrees_to_radians(degrees)
7373}
7474
7575function oscillateCamera ( ) {
76- thetaX += 0.1 ;
77- thetaY += 0.05 ;
78- thetaZ += 0.05 ;
76+ thetaX += 0.3 ;
77+ thetaY += 0.03 ;
78+ thetaZ += 0.001 ;
7979
8080 camera . position . x = radius * Math . sin ( degrees_to_radians ( thetaX ) ) ;
8181 camera . position . y = radius * Math . sin ( degrees_to_radians ( thetaY ) ) ;
82- camera . position . z = 3 + radius * Math . cos ( degrees_to_radians ( thetaZ ) ) ;
82+ camera . position . z = 10 + radius * Math . cos ( degrees_to_radians ( thetaZ ) ) ;
8383 camera . lookAt ( scene . position ) ;
8484}
8585
@@ -91,8 +91,8 @@ var animate = function () {
9191 for ( var i = 0 ; i < obstacles . length ; i ++ ) {
9292 obstacles [ i ] . position . x -= 0.05 ;
9393
94- if ( obstacles [ i ] . position . x < ( initial_x - 15 ) ) {
95- obstacles [ i ] . position . x = 10 + Math . floor ( Math . random ( ) * 300 ) ;
94+ if ( obstacles [ i ] . position . x < ( initial_x - 50 ) ) {
95+ obstacles [ i ] . position . x = player . position . x + 20 + Math . floor ( Math . random ( ) * 300 ) ;
9696 }
9797 }
9898
@@ -155,7 +155,7 @@ var animate = function () {
155155
156156 var trail = new THREE . Mesh (
157157 geometry ,
158- new THREE . MeshBasicMaterial ( { color : 0x555555 , opacity : 0.8 , transparent : true } )
158+ new THREE . MeshBasicMaterial ( { color : 0x444444 , opacity : 0.8 , transparent : true } )
159159 ) ;
160160
161161 trail . position . x = player . position . x ;
0 commit comments