You may now click on any part of the arrow
This commit is contained in:
		
							parent
							
								
									71e942c69f
								
							
						
					
					
						commit
						b22e35660a
					
				| @ -37,8 +37,8 @@ CameraContainer.prototype.get = function(i) { | |||||||
| 
 | 
 | ||||||
| CameraContainer.prototype.getById = function(id) { | CameraContainer.prototype.getById = function(id) { | ||||||
|     for (var i in this.cameras) { |     for (var i in this.cameras) { | ||||||
|         if (this.cameras[i].mesh !== undefined) { |         if (this.cameras[i].object3D !== undefined) { | ||||||
|             if (this.cameras[i].mesh.id == id) { |             if (this.cameras[i].object3D.id == id) { | ||||||
|                 return this.get(i); |                 return this.get(i); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -100,6 +100,10 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { | |||||||
|     // this.arrow = new THREE.Line(new THREE.Geometry(), new THREE.LineBasicMaterial({color: 0xff0000}), THREE.LinePieces);
 |     // this.arrow = new THREE.Line(new THREE.Geometry(), new THREE.LineBasicMaterial({color: 0xff0000}), THREE.LinePieces);
 | ||||||
|     this.arrow = new THREE.Mesh(new THREE.Geometry(), new THREE.MeshLambertMaterial({color: 0xff0000, side:THREE.DoubleSide})); |     this.arrow = new THREE.Mesh(new THREE.Geometry(), new THREE.MeshLambertMaterial({color: 0xff0000, side:THREE.DoubleSide})); | ||||||
| 
 | 
 | ||||||
|  |     this.object3D = new THREE.Object3D(); | ||||||
|  |     this.object3D.add(this.mesh); | ||||||
|  |     this.object3D.add(this.arrow); | ||||||
|  | 
 | ||||||
|     this.fullArrow = false; |     this.fullArrow = false; | ||||||
| } | } | ||||||
| FixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); | FixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); | ||||||
| @ -180,6 +184,8 @@ FixedCamera.prototype.regenerateArrow = function(mainCamera) { | |||||||
| 
 | 
 | ||||||
|     this.arrow.geometry.mergeVertices(); |     this.arrow.geometry.mergeVertices(); | ||||||
|     this.arrow.geometry.computeFaceNormals(); |     this.arrow.geometry.computeFaceNormals(); | ||||||
|  |     // this.arrow.geometry.computeVertexNormals();
 | ||||||
|  |     this.arrow.geometry.computeBoundingSphere(); | ||||||
| 
 | 
 | ||||||
|     // this.arrow.geometry.vertices[0] = new THREE.Vector3(); // mainCamera.position.clone();
 |     // this.arrow.geometry.vertices[0] = new THREE.Vector3(); // mainCamera.position.clone();
 | ||||||
|     // this.arrow.geometry.vertices[1] = this.position.clone();
 |     // this.arrow.geometry.vertices[1] = this.position.clone();
 | ||||||
| @ -200,12 +206,9 @@ FixedCamera.prototype.look = function() { | |||||||
| 
 | 
 | ||||||
| FixedCamera.prototype.addToScene = function(scene) { | FixedCamera.prototype.addToScene = function(scene) { | ||||||
|     scene.add(this); |     scene.add(this); | ||||||
|     scene.add(this.mesh); |     scene.add(this.object3D); | ||||||
|     scene.add(this.border); |  | ||||||
|     scene.add(this.arrow); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FixedCamera.prototype.traverse = function(callback) { | FixedCamera.prototype.traverse = function(callback) { | ||||||
|     callback(this.mesh); |     this.object3D.traverse(callback); | ||||||
|     callback(this.border); |  | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										16
									
								
								prototype/js/main.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								prototype/js/main.js
									
									
									
									
										vendored
									
									
								
							| @ -86,8 +86,8 @@ function init() { | |||||||
| 
 | 
 | ||||||
|     // THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
 |     // THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
 | ||||||
|     var loader = new THREE.OBJMTLLoader(); |     var loader = new THREE.OBJMTLLoader(); | ||||||
|     loader.load( '/data/castle/princess peaches castle (outside).obj', |     loader.load( static_path + 'data/castle/princess peaches castle (outside).obj', | ||||||
|                  '/data/castle/princess peaches castle (outside).mtl', |                  static_path + 'data/castle/princess peaches castle (outside).mtl', | ||||||
|     function ( object ) { |     function ( object ) { | ||||||
|         object.up = new THREE.Vector3(0,0,1); |         object.up = new THREE.Vector3(0,0,1); | ||||||
|         scene.add(object); |         scene.add(object); | ||||||
| @ -103,8 +103,8 @@ function init() { | |||||||
|         }); |         }); | ||||||
|     }, onProgress, onError ); |     }, onProgress, onError ); | ||||||
| 
 | 
 | ||||||
|     loader.load( '/data/first/Floor 1.obj', |     loader.load( static_path + 'data/first/Floor 1.obj', | ||||||
|                  '/data/first/Floor 1.mtl', |                  static_path + 'data/first/Floor 1.mtl', | ||||||
|     function ( object ) { |     function ( object ) { | ||||||
|         object.position.z -= 10.9; |         object.position.z -= 10.9; | ||||||
|         object.position.y += 0.555; |         object.position.y += 0.555; | ||||||
| @ -128,8 +128,8 @@ function init() { | |||||||
|         }); |         }); | ||||||
|     }, onProgress, onError ); |     }, onProgress, onError ); | ||||||
| 
 | 
 | ||||||
|     // loader.load( '/data/bobomb/bobomb battlefeild.obj',
 |     // loader.load( static_path + 'data/bobomb/bobomb battlefeild.obj',
 | ||||||
|     //              '/data/bobomb/bobomb battlefeild.mtl',
 |     //              static_path + 'data/bobomb/bobomb battlefeild.mtl',
 | ||||||
|     //         function ( object ) {
 |     //         function ( object ) {
 | ||||||
|     //             // object.position.z -= 10.9;
 |     //             // object.position.z -= 10.9;
 | ||||||
|     //             // object.position.y += 0.555;
 |     //             // object.position.y += 0.555;
 | ||||||
| @ -274,8 +274,8 @@ function click(event) { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (bestIndex !== undefined) { |         if (bestIndex !== undefined) { | ||||||
|             if (cameras.getById(intersects[bestIndex].object.id) !== undefined) { |             if (cameras.getById(intersects[bestIndex].object.parent.id) !== undefined) { | ||||||
|                 var new_camera = cameras.getById(intersects[bestIndex].object.id); |                 var new_camera = cameras.getById(intersects[bestIndex].object.parent.id); | ||||||
|                 // hide(new_camera);
 |                 // hide(new_camera);
 | ||||||
|                 cameras.get(0).move(new_camera); |                 cameras.get(0).move(new_camera); | ||||||
|             } |             } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user