   moved: false
   sprinted: false
 
+  intersects: []
+
+  directions: {
+    axe: new THREE.Vector3(0, 1, 0)
+    default: new THREE.Vector3(0, 0, 1)
+    down: new THREE.Vector3(0, -1, 0)
+  }
+
   constructor: (camera, @defaultPosition, @objects) ->
     @cameraPitch = camera
     @cameraYaw = camera

    speed = if @sprinted then @speed * 2 else @speed

    # Intersects
    @rayCaster_under.set(@cameraYaw.position, new THREE.Vector3(0, -1, 0))
    intersections = @rayCaster_under.intersectObjects(@objects)
    intersect = intersections[0] if intersections.length > 0
    distance = Math.round(intersect.distance)
    @height = Math.abs(Math.round(@cameraYaw.position.y - distance)) + @defaultPosition.y

    x = -Math.sin(@cameraYaw.rotation._y)
    z = -Math.cos(@cameraYaw.rotation._y)
    x30 = -Math.sin(@cameraYaw.rotation._y + Math.PI/6)
    z30 = -Math.cos(@cameraYaw.rotation._y + Math.PI/6)
    x30m = -Math.sin(@cameraYaw.rotation._y - Math.PI/6)
    z30m = -Math.cos(@cameraYaw.rotation._y - Math.PI/6)
    if (@getIntersect(new THREE.Vector3(x, 0, z)) or @getIntersect(new THREE.Vector3(x30, 0, z30)) or @getIntersect(new THREE.Vector3(x30m, 0, z30m)))
      console.log(x30)
      intersectFront = false
    else
      intersectFront = true

    x = Math.sin(@cameraYaw.rotation._y)
    z = Math.cos(@cameraYaw.rotation._y)
    x30 = Math.sin(@cameraYaw.rotation._y + Math.PI/6)
    z30 = Math.cos(@cameraYaw.rotation._y + Math.PI/6)
    x30m = Math.sin(@cameraYaw.rotation._y - Math.PI/6)
    z30m = Math.cos(@cameraYaw.rotation._y - Math.PI/6)
    if (@getIntersect(new THREE.Vector3(x, 0, z)) or @getIntersect(new THREE.Vector3(x30, 0, z30)) or @getIntersect(new THREE.Vector3(x30m, 0, z30m)))
      intersectBack = false
    else
      intersectBack = true

    x = -Math.sin(@cameraYaw.rotation._y + Math.PI/2)
    z = -Math.cos(@cameraYaw.rotation._y + Math.PI/2)
    x30 = -Math.sin(@cameraYaw.rotation._y + Math.PI/2 + Math.PI/6)
    z30 = -Math.cos(@cameraYaw.rotation._y + Math.PI/2 + Math.PI/6)
    x30m = -Math.sin(@cameraYaw.rotation._y + Math.PI/2 - Math.PI/6)
    z30m = -Math.cos(@cameraYaw.rotation._y + Math.PI/2 - Math.PI/6)
    if (@getIntersect(new THREE.Vector3(x, 0, z)) or @getIntersect(new THREE.Vector3(x30, 0, z30)) or @getIntersect(new THREE.Vector3(x30m, 0, z30m)))
      intersectLeft = false
    else
      intersectLeft = true

    x = Math.sin(@cameraYaw.rotation._y + Math.PI/2)
    z = Math.cos(@cameraYaw.rotation._y + Math.PI/2)
    x30 = Math.sin(@cameraYaw.rotation._y + Math.PI/2 + Math.PI/6)
    z30 = Math.cos(@cameraYaw.rotation._y + Math.PI/2 + Math.PI/6)
    x30m = Math.sin(@cameraYaw.rotation._y + Math.PI/2 - Math.PI/6)
    z30m = Math.cos(@cameraYaw.rotation._y + Math.PI/2 - Math.PI/6)
    if (@getIntersect(new THREE.Vector3(x, 0, z)) or @getIntersect(new THREE.Vector3(x30, 0, z30)) or @getIntersect(new THREE.Vector3(x30m, 0, z30m)))
      intersectRight = false
    else
      intersectRight = true

    if @moved and pointerLocked
      @velocity.z -= speed * delta if keyW and intersectFront
      @velocity.z += speed * delta if keyS and intersectBack
      @velocity.x -= speed * delta if keyA and intersectLeft
      @velocity.x += speed * delta if keyD and intersectRight

    # Jumping
    if Key.isPressed("space")

    @velocity.x -= @velocity.x * 10.0 * delta
    @velocity.z -= @velocity.z * 10.0 * delta


  handleMouseMove: (event) ->
    movementX = event["movementX"] or event["mozMovementX"] or event["webkitMovementX"] or 0
