     @group.updateMatrix()
         
   makeChunk: ->
+    unless @lastState
+      @lastState = @isim.getInterpolatedState()
     states = for i in [0...@chunkSize] by 1
       @isim.nextTime 1
       @isim.getInterpolatedState()
     #create lines
     chunk = new THREE.Object3D
     for i in [0...@nCells]
-      tubeGeom = @createTube states, i*2
+      tubeGeom = @createTube states, i*2, @lastState
       tube = new THREE.Mesh tubeGeom, @materials[i]
       chunk.add tube
+    @lastState = states[states.length-1]
     return chunk
 
 
-  createTube: (xys, i)->
+  createTube: (xys, i, xy0)->
     vs = new Float32Array xys.length*4*3 #x,y,z; 4 vertices
     ixs =  new Uint16Array (xys.length-1)*2*3*4 #2 triangles
     curIx = 0

      return
      
    r = @tubeRadius
    for xy, iz in xys
      z = iz*@stepZ
      x=xy[i]
      y=xy[i+1]
      vindex = curV / 3 | 0

      pushXYZ x-r,y,z
      pushXYZ x,y+r,z
      pushXYZ x+r,y,z
      pushXYZ x,y-r,z
      if iz >0
        for j in [0...4]
          j1 = (j+1)%4

  container = document.getElementById("container")
  
  #
  camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 10500)
  camera.position.z = 2750
  scene = new THREE.Scene()
  scene.fog = new THREE.Fog 0x050505, 2000, 10500
  #scene.add new THREE.AmbientLight 0x444444 

  controls = new THREE.TrackballControls  camera

