title: Three.js 3D Scene, Uncaught Type Error: "Cannot read property 'x' of undefined" Vertex/Particle Position
body: <p>I'm attempting to create a randomly distributed particle field that exhibits Brownian (random) motion.</p>
  
  <p>Scroll to the bottom of the code to see where the error happens. I'm trying to set the position of a single vertex with position.x.</p>
  
  <p>I'll omit the rest of the code not directly related to rendering the particles in effort to save your time.</p>
  
  <pre><code>//Using WebGL renderer...
  
  var particle, particles = [], particle_system, material, p_x, p_y, p_z;
  
  particles = new THREE.Geometry(); 
  
  material = new THREE.ParticleBasicMaterial({color: 0xffffff, size: 1});
  
  for(var count = 0; count &lt; 1000; count++){
  
      p_x = Math.random() * 1000 - 500;
  
      p_y = Math.random() * 1000 - 500;
  
      p_z = Math.random() * 1000 - 500;
  
      particle = new THREE.Vector3(p_x, p_y, p_z);
  
      particles.vertices.push(particle);
  
  }
  
  particle_system = new THREE.ParticleSystem(particles, material);
  
  scene.add(particle_system);
  
  particle_system.geometry.dynamic = true;
  
  //All of the code bellow will go into the render loop.    
  
  var index = 0;
  
  while(index &lt; 1000){
  
      index++;
  
      particle_system.geometry.verticiesNeedUpdate = true;
  
      //THESE 3 LINES BELLOW CAUSE THE ERROR
  
      particles.vertices[index].position.x += Math.random() * 1000 - 500;
  
      particles.vertices[index].position.y += Math.random() * 1000 - 500;
  
      particles.vertices[index].position.z += Math.random() * 1000 - 500;
  </code></pre>
  
  <p>}</p>