You may now click on any part of the arrow

This commit is contained in:
Thomas FORGIONE
2015-04-20 10:05:54 +02:00
parent 71e942c69f
commit b22e35660a
3 changed files with 18 additions and 15 deletions

View File

@@ -37,8 +37,8 @@ CameraContainer.prototype.get = function(i) {
CameraContainer.prototype.getById = function(id) {
for (var i in this.cameras) {
if (this.cameras[i].mesh !== undefined) {
if (this.cameras[i].mesh.id == id) {
if (this.cameras[i].object3D !== undefined) {
if (this.cameras[i].object3D.id == id) {
return this.get(i);
}
}

View File

@@ -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.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;
}
FixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype);
@@ -180,6 +184,8 @@ FixedCamera.prototype.regenerateArrow = function(mainCamera) {
this.arrow.geometry.mergeVertices();
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[1] = this.position.clone();
@@ -200,12 +206,9 @@ FixedCamera.prototype.look = function() {
FixedCamera.prototype.addToScene = function(scene) {
scene.add(this);
scene.add(this.mesh);
scene.add(this.border);
scene.add(this.arrow);
scene.add(this.object3D);
}
FixedCamera.prototype.traverse = function(callback) {
callback(this.mesh);
callback(this.border);
this.object3D.traverse(callback);
}