title: Three js - accessing objects thats not in the scene
body: <p>Im sorry if this has been asked before, but so far i have not found anything. But my problem is that I want to create two functions where I create a path in one of them and some object in another, lets say a sphere. </p>
  
  <pre><code>function makeCurve() {
      var Path = new THREE.CubicBezierCurve3(
          new THREE.Vector3(0, 0, 0),
          new THREE.Vector3(0, 70, 0),
          new THREE.Vector3(0, 70, 20),
          new THREE.Vector3(0, 0, 20)
      );
      Path.id = 'IwantThisPath';
      var geometry = new THREE.Geometry();
      geometry.vertices = Path.getPoints(50);
      var material = new THREE.LineBasicMaterial({
          color: 0xff0000
      });
      var PathObject = new THREE.Line(geometry, material);
      PathObject.name = pathname;
      scene.add(PathObject)
  }
  
  function sphere() {
      var object = new THREE.Mesh(new THREE.SphereGeometry(20, 100, 100), new THREE.MeshNormalMaterial());
      object.overdraw = true;
      sphere.name = spherename;
      scene.add(sphere)
  }
  </code></pre>
  
  <p>A textarea would then be linked to those functions and a user would then be able to easily create a sphere and a path by</p>
  
  <pre><code>path1 = new makeCurve();
  sphere1 = new sphere();  
  </code></pre>
  
  <p>I then want to create the third function, where i can make the sphere travel along the path. </p>
  
  <pre><code>function along(path, object) {
      name1 = path.name;
      name2 = object.name;
      var MyPath = document.getElementById('IwantThisPath') //givesNull
      myObjPath = scene.getObjectByName(name1); //I don't want this one
      myObjObject = scene.getObjectByName(name2);
      counter = 0;
      var tangent = new THREE.Vector3();
      var axis = new THREE.Vector3();
      var up = new THREE.Vector3(0, 1, 0);
      setInterval(moveObject, 50);
  
      function moveObject() {
          if (counter &lt;= 1) {
              myObjObject.position.copy(myObjPath.getPointAt(counter));
  
              tangent = myObjPath.getTangentAt(counter).normalize();
  
              axis.crossVectors(up, tangent).normalize();
  
              var radians = Math.acos(up.dot(tangent));
  
              myObjObject.quaternion.setFromAxisAngle(axis, radians);
          } else {
              counter = 0
          }
      }
  }
  </code></pre>
  
  <p>In the last functions, things get tricky. Because I can't use the PathObject that was added to the scene to make the sphere move, I need the Path made in the beginning. But I cant fetch it, no matter what I try. It's not added to the scene and putting an id or name on it just renders null. 
  I hope someone has a better solution for me to solve this problem and that this is clear enough. </p>
  
  <p>For the curious: Im writing a program so I can create three.js animation easier, I want to create teaching material in physics using this.  </p>