     @hasChanged = true
     @activePlane = PLANE_XY
     @rayThreshold = [10, 10, 10, 100]
+    @spaceDirection = 1
 
   #reset : ->
   #  @zoomSteps=[1,1,1]

    @texturePosition[planeID]

  setGlobalPos : (position) ->
    @globalPosition = position
    @hasChanged = true

  setActivePlane : (activePlane) ->
    @activePlane = activePlane

  getActivePlane : ->
    @activePlane

  setDirection : (direction) ->
    @direction = direction

  setSpaceDirection : ->
    ind = @getIndices @activePlane
    if @direction[ind[2]] <= 0
      @spaceDirection = -1
    else
      @spaceDirection = 1

  getSpaceDirection : ->
    @spaceDirection

  move : (p) -> #move by whatever is stored in this vector
    if @activePlane == PLANE_XY
      # BAD consider the different resolution in z-direction
      @setGlobalPos([@globalPosition[0]+p[0], @globalPosition[1]+p[1], @globalPosition[2]+2*p[2]])
    else
      @setGlobalPos([@globalPosition[0]+p[0], @globalPosition[1]+p[1], @globalPosition[2]+p[2]])
    
  moveActivePlane : (p) ->
    ind = @getIndices @activePlane
    f = Math.pow(2, @integerZoomSteps[@activePlane])
    # change direction of the value connected to space, based on the last direction
    delta = [p[ind[0]]*f, p[ind[1]]*f, p[ind[2]]*f]
    delta[ind[2]] *= @spaceDirection
    @move(delta)

  toString : ->
    position = @globalPosition
