title: three.js no camera collision with list collidable objects
body: <p>in my scene i have one floor, 4 walls and 2 box. i use fps to control my camera. I make a list of collidable objets (colmeshList). but when i make a ray, have not hit intersect between camera and colmeshList. i din't understand where is my error and what i have not unterdstood.</p>
  
  <pre><code>`var scene, anbientLight, controls, camera, renderer;
          var geometry, material, mesh, bbox ;
          var collmeshList = [];
          var prevTime = performance.now();
          var velocity = new THREE.Vector3();
  
  init();
  animate();
  
  function init() {
  
  scene = new THREE.Scene();
  
  ambientLight = new THREE.AmbientLight(0x020202);
     scene.add(ambientLight);
  
  
  //////WORLD
  //FLOOR
  floorGeometry = new THREE.PlaneGeometry( 500, 500 );
  floorMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: false } );
  floorMesh = new THREE.Mesh( floorGeometry, floorMaterial );
  floorMesh.rotation.x = Math.PI/2;
  floorMesh.rotation.y = Math.PI;
  scene.add( floorMesh );
  
  //WALLS
      W01Geometry = new THREE.BoxGeometry( 500, 200,0.001, 8,8 );
      W01Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
      W01Mesh = new THREE.Mesh( W01Geometry, W01Material );
     W01Mesh.position.z = -250;
     collmeshList.push (W01Mesh);
     scene.add( W01Mesh );
  
     W02Geometry = new THREE.BoxGeometry( 500, 200,0.001, 8,8 );
      W02Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
      W02Mesh = new THREE.Mesh( W02Geometry, W02Material );
     W02Mesh.rotation.y = Math.PI/2;
     W02Mesh.position.x = -250;
    //W01Mesh.rotation.y = Math.PI;
     collmeshList.push (W02Mesh);
     scene.add( W02Mesh );
  
       W03Geometry = new THREE.BoxGeometry( 500, 200,0.001, 8,8 );
       W03Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
       W03Mesh = new THREE.Mesh( W03Geometry, W03Material );
       W03Mesh.rotation.y = -Math.PI/2;
       W03Mesh.position.x = 250;
       collmeshList.push (W03Mesh);
       scene.add( W03Mesh );
  
        W04Geometry = new THREE.BoxGeometry( 500, 200,0.001, 8,8 );
        W04Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
      W04Mesh = new THREE.Mesh( W04Geometry, W01Material );
      W04Mesh.rotation.y = Math.PI;
      W04Mesh.position.z = -250;
      collmeshList.push (W04Mesh);
      scene.add( W04Mesh );
  
  
      //wallGroup = new THREE.Group();
      //wallGroup.add(W01Mesh, W02Mesh, W03Mesh, W04Mesh);
      //wallGroup.position.y = 50;
      //scene.add(wallGroup);
  
      //OBSTACLES
      B01Geometry = new THREE.BoxGeometry( 50, 50,50 );
      B01Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
      B01Mesh = new THREE.Mesh( B01Geometry, B01Material );
      B01Mesh.position.z = -100;
      B01Mesh.position.y = 25;
      collmeshList.push (B01Mesh);
      scene.add( B01Mesh );
  
      B02Geometry = new THREE.BoxGeometry( 50, 50,50 );
      B02Material = new THREE.MeshBasicMaterial( { color: 0xffffff, side:THREE.DoubleSide, wireframe: false } );
      B02Mesh = new THREE.Mesh( B02Geometry, B02Material );
      B02Mesh.position.z = 100;
      B02Mesh.position.y = 25;
      collmeshList.push (B02Mesh);
      scene.add( B02Mesh );
  
  
      //////PLAYER
      camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
      camera.position.x = 0;
      camera.position.y = 40;
      camera.position.z = 50;
      camera.updateMatrix();
  
  
      //////CONTROLS CAMERA
     controls = new THREE.FirstPersonControls( camera );
     scene.add( controls.getObject() );
  
  
    //////RENDU
    renderer = new THREE.WebGLRenderer();
    renderer.setSize( window.innerWidth, window.innerHeight );
  
    document.body.appendChild( renderer.domElement );
  
    }
  
    function clearText()
    {   document.getElementById('message').innerHTML = '..........';   }
  
    function appendText(txt)
    {   document.getElementById('message').innerHTML += txt;   }
  
    function animate() {
  
    requestAnimationFrame( animate );
  
    playerControls();
  
    //collupdate();
  
  
  
  
    renderer.render( scene, camera );
  
    }
  
  
          function playerControls () {
  
          //unlockAllDirection();
  
  
  
              // Are the controls enabled? (Does the browser have pointer lock?)
              if ( controls.controlsEnabled ) {
  
                  // Save the current time
                  var time = performance.now();
                  // Create a delta value based on current time
                  var delta = ( time - prevTime ) / 1000;
  
                  // Set the velocity.x and velocity.z using the calculated time delta
                  velocity.x -= velocity.x * 10.0 * delta;
                  velocity.z -= velocity.z * 10.0 * delta;
  
                  // As velocity.y is our "gravity," calculate delta
                  velocity.y -= 9.8 * 100.0 * delta; // 100.0 = mass
  
                  if ( controls.moveForward ) {
                      velocity.z -= 400.0 * delta;
                      // Nothing to do!
                  }
  
                  if ( controls.moveBackward ) {
                      velocity.z += 400.0 * delta;
  
                  }
  
                  if ( controls.moveLeft ) {
                      velocity.x -= 400.0 * delta;
  
                  }
  
                  if ( controls.moveRight ) {
                      velocity.x += 400.0 * delta;
  
                  }
  
  
                  // Update the position using the changed delta
                  controls.getObject().translateX( velocity.x * delta );
                  controls.getObject().translateY( velocity.y * delta );
                  controls.getObject().translateZ( velocity.z * delta );
  
                  // Prevent the camera/player from falling out of the 'world'
                  if ( controls.getObject().position.y &lt; 10 ) {
  
                      velocity.y = 0;
                      controls.getObject().position.y = 10;
  
                      }
  
                  // Save the time for future delta calculations
                  prevTime = time;
  
                  }
          }
  
          function collupdate (){
  
    clearText();
  
    var cameraDirection = controls.getDirection(new THREE.Vector3(0, 0, 0)).clone();
    direction.applyQuaternion( cameraDirection.quaternion );
    var ray = new THREE.Raycaster(controls.getObject().position, cameraDirection);    
    var intersects = rayCaster.intersectObject(collmeshList, true);  
    if ( intersects.length &gt; 0 &amp;&amp; intersects[0].distance &lt; directionVector.length() )
    lockDirection();
    appendText(hits);
  
     }    `
  </code></pre>