 
     # Initializing Position
     gPos = cam2d.getGlobalPos()
-    @routeView.position = new THREE.Vector3(-gPos[0], gPos[1], gPos[2]+1)
+    pos = [[-gPos[0], gPos[1], gPos[2]], [-gPos[2], gPos[1], -gPos[0]], [-gPos[0], gPos[2], -gPos[1]]]
+    for i in [0..2]
+      @routeView[i].position = new THREE.Vector3(pos[i][0], pos[i][1], pos[i][2]+1)
 
     particle = new THREE.Mesh(new THREE.CubeGeometry(300, 300, 300, 10, 10, 10), new THREE.MeshBasicMaterial({color: 0xff0000}))
     particle.position.x = 0


    @addGeometry VIEW_3D, route
    @addGeometry VIEW_3D, particleSystem
    @addGeometry PLANE_XY, routeView

  updateRoute : ->
    gPos                = cam2d.getGlobalPos()
    scale               = cam2d.getPlaneScalingFactor PLANE_XY
    console.log "scale (alt): " + @routeView.scale
    console.log "scale: " + scale
    @routeView.scale    = new THREE.Vector3(1/scale, 1/scale, 1/scale)
    @routeView.position = new THREE.Vector3(-gPos[0]/scale, gPos[1]/scale, gPos[2]/scale+1)
    #@routeView.position = new THREE.Vector3(@routeView.position.x - p[0], @routeView.position.y + p[1], cam2d.getGlobalPos()[2]+1)
    @routeView.geometry.verticesNeedUpdate = true

  setActivePlane : (planeID) ->
    cam2d.setActivePlane planeID
    for i in [0..2]
      $("canvas")[i].style.borderColor = if i==planeID then "#f8f800" else "#C7D1D8"
    cam2d.hasChanged = true

  setWaypoint : (position) ->
    curGlobalPos = cam2d.getGlobalPos()
    activePlane  = cam2d.getActivePlane()
    zoomFactor   = cam2d.getPlaneScalingFactor activePlane
    # calculate the global position of the rightclick
    switch activePlane
      when PLANE_XY then position = [curGlobalPos[0] - (VIEWPORT_WIDTH/2 - position[0])*zoomFactor, curGlobalPos[1] - (VIEWPORT_WIDTH/2 - position[1])*zoomFactor, curGlobalPos[2]]
      when PLANE_YZ then position = [curGlobalPos[0], curGlobalPos[1] - (VIEWPORT_WIDTH/2 - position[1])*zoomFactor, curGlobalPos[2] - (VIEWPORT_WIDTH/2 - position[0])*zoomFactor]
      when PLANE_XZ then position = [curGlobalPos[0] - (VIEWPORT_WIDTH/2 - position[0])*zoomFactor, curGlobalPos[1], curGlobalPos[2] - (VIEWPORT_WIDTH/2 - position[1])*zoomFactor]
    unless @curIndex
      @curIndex = 0
    # Translating ThreeJS' coordinate system to the preview's one
    if @curIndex < @maxRouteLen
      @route.geometry.vertices[@curIndex] = new THREE.Vector3(position[0], Game.dataSet.upperBoundary[1] - position[2], position[1])
      pos = [[position[0], -position[1], -position[2]], [position[2], -position[1], position[0]], [position[0], -position[2], position[1]]]
      for i in [0..2]
        @routeView[i].geometry.vertices[@curIndex] = new THREE.Vector3(pos[i][0], pos[i][1], pos[i][2])
        @routeView[i].geometry.verticesNeedUpdate = true
      @particleSystem.geometry.vertices[@curIndex] = new THREE.Vector3(position[0], Game.dataSet.upperBoundary[1] - position[2], position[1])
      
      @route.geometry.verticesNeedUpdate = true
      @particleSystem.geometry.verticesNeedUpdate = true
      @curIndex += 1
      cam2d.hasChanged = true
