title: Getting terrain's height (y) coordinate Three.js
body: <p>I have a terrain as Collada model. I need to add other models on my terrain. For this I think I need to get terrain's height coord (y) by x and z coordinates. Please tell me how can i do that?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var scene, camera, renderer;
  
          var raycaster = new THREE.Raycaster();
          var mouse = new THREE.Vector2();
          var directionVector = new THREE.Vector3();
          var projector = new THREE.Projector();
  
          var map =
                  {
                      'name': 'map1.dae',
                      'x': -42.1,
                      'y': 54,
                      'z': 0
                  }
                  ;
  
          var mapModel;
          var mapLoader = new THREE.ColladaLoader();
          mapLoader.options.convertUpAxis = true;
  
          mapLoader.load( map.name, function ( collada ) {
              mapModel = collada.scene;
  
              mapModel.position.set(map.x,map.z,map.y);//x,z,y- if you think in blender dimensions ;)
              mapModel.rotation.y = 0.002;
  
              init();
              animate();
          });
  
  
          function init() {
              scene = new THREE.Scene();
              var WIDTH = window.innerWidth,
                      HEIGHT = window.innerHeight;
              renderer = new THREE.WebGLRenderer({antialias:true});
              renderer.setSize(WIDTH, HEIGHT);
              renderer.setClearColor( 0xeeeeee, 1.0 );
              document.body.appendChild(renderer.domElement);
              camera = new THREE.PerspectiveCamera(45, WIDTH / HEIGHT, 0.1, 10000);
              camera.position.set(150,450,300);
              scene.add(camera);
              window.addEventListener('resize', function() {
                  var WIDTH = window.innerWidth,
                          HEIGHT = window.innerHeight;
                  renderer.setSize(WIDTH, HEIGHT);
                  camera.aspect = WIDTH / HEIGHT;
                  camera.updateProjectionMatrix();
              });
              window.addEventListener('click',onMouseClick);
              window.addEventListener('mouseMove',onMouseMove);
              var axes = new THREE.AxisHelper( 1580 );
              scene.add(axes);
  
              var gridXZ = new THREE.GridHelper(1000, 10);
              gridXZ.setColors( new THREE.Color(0xff0000), new THREE.Color(0xff0000) );
              gridXZ.position.set(0,0,0 );
              //red axe 0.00001565217 - CONST в 1 метре, градусов     blue axe 0.000009
              scene.add(gridXZ);
  
              scene.add(mapModel);
  
  
              var light = new THREE.PointLight(0xfffff3, 0.8);
              light.position.set(-300,600,300);
              scene.add(light);
              var sphereSize = 1;
              var pointLightHelper = new THREE.PointLightHelper( light, sphereSize );
              scene.add( pointLightHelper );
              var light2 = new THREE.PointLight(0xd7f0ff, 0.2);
              light2.position.set(600,600,200);
              scene.add(light2);
              var sphereSize = 1;
              var pointLightHelper2 = new THREE.PointLightHelper( light2, sphereSize );
              scene.add( pointLightHelper2 );
              var light3 = new THREE.PointLight(0xFFFFFF, 0.5);
              light3.position.set(300,400,-200);
              scene.add(light3);
              var sphereSize = 1;
              var pointLightHelper3 = new THREE.PointLightHelper( light3, sphereSize );
              scene.add( pointLightHelper3 );</code></pre>
  </div>
  </div>
  </p>
  
  <p>[Image][1]<a href="http://i.stack.imgur.com/bZqE4.jpg" rel="nofollow">http://i.stack.imgur.com/bZqE4.jpg</a></p>