|
67 | 67 | scene.add( camera );
|
68 | 68 |
|
69 | 69 | crosshair = new THREE.Mesh(
|
70 |
| - new THREE.RingGeometry( 0.5, 1, 32 ), |
| 70 | + new THREE.RingGeometry( 0.02, 0.04, 32 ), |
71 | 71 | new THREE.MeshBasicMaterial( {
|
72 | 72 | color: 0xffffff,
|
73 | 73 | opacity: 0.5,
|
74 | 74 | transparent: true
|
75 | 75 | } )
|
76 | 76 | );
|
77 |
| - crosshair.position.z = - 40; |
| 77 | + crosshair.position.z = - 2; |
78 | 78 | camera.add( crosshair );
|
79 | 79 |
|
80 | 80 | var mesh = new THREE.Mesh(
|
|
89 | 89 | light.position.set( 1, 1, 1 ).normalize();
|
90 | 90 | scene.add( light );
|
91 | 91 |
|
92 |
| - var geometry = new THREE.BoxGeometry( 3, 3, 3 ); |
| 92 | + var geometry = new THREE.BoxGeometry( 5, 5, 5 ); |
93 | 93 |
|
94 | 94 | for ( var i = 0; i < 200; i ++ ) {
|
95 | 95 |
|
96 | 96 | var object = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial( { color: Math.random() * 0xffffff } ) );
|
97 | 97 |
|
98 |
| - object.position.x = Math.random() * 100 - 50; |
99 |
| - object.position.y = Math.random() * 100 - 50; |
100 |
| - object.position.z = Math.random() * 100 - 50; |
| 98 | + object.position.x = Math.random() * 200 - 100; |
| 99 | + object.position.y = Math.random() * 200 - 100; |
| 100 | + object.position.z = Math.random() * 200 - 100; |
101 | 101 |
|
102 | 102 | object.rotation.x = Math.random() * 2 * Math.PI;
|
103 | 103 | object.rotation.y = Math.random() * 2 * Math.PI;
|
|
202 | 202 |
|
203 | 203 | cube.position.add( cube.userData.velocity );
|
204 | 204 |
|
205 |
| - if ( cube.position.x < 100 ) cube.position.x += 200; |
206 |
| - if ( cube.position.y < 100 ) cube.position.y += 200; |
207 |
| - if ( cube.position.z < 100 ) cube.position.z += 200; |
| 205 | + if ( cube.position.x < - 100 || cube.position.x > 100 ) { |
208 | 206 |
|
209 |
| - if ( cube.position.x > 100 ) cube.position.x -= 200; |
210 |
| - if ( cube.position.y > 100 ) cube.position.y -= 200; |
211 |
| - if ( cube.position.z > 100 ) cube.position.z -= 200; |
| 207 | + cube.userData.velocity.x = - cube.userData.velocity.x; |
| 208 | + |
| 209 | + } |
| 210 | + |
| 211 | + if ( cube.position.y < - 100 || cube.position.y > 100 ) { |
| 212 | + |
| 213 | + cube.userData.velocity.y = - cube.userData.velocity.y; |
| 214 | + |
| 215 | + } |
| 216 | + |
| 217 | + if ( cube.position.z < - 100 || cube.position.z > 100 ) { |
| 218 | + |
| 219 | + cube.userData.velocity.z = - cube.userData.velocity.z; |
| 220 | + |
| 221 | + } |
212 | 222 |
|
213 | 223 | cube.rotation.x += 0.01;
|
214 | 224 |
|
|
0 commit comments